Get access to Marker handle of a line plot

조회 수: 5 (최근 30일)
Lothar Löwer
Lothar Löwer 2018년 2월 22일
답변: Paul Smits 2019년 4월 4일
I trying to get acces of the "MarkerHandle" of a line plot:
h_plot = line(x,y); hMarkers = get(h_plot,'MarkerHandle');
It works great in case I am running the code in debug mode. Unfortunatelly, running the program in "normal" mode, I don't get access to the handle (results in "0×0 empty GraphicsPlaceholder array"). Any ideas?
  댓글 수: 1
Lukas Fricke
Lukas Fricke 2018년 5월 3일
Sounds like a concurrency issue to me. Did you try with an intermediate "drawnow"?

댓글을 달려면 로그인하십시오.

답변 (2개)

Bhuvnesh Singh
Bhuvnesh Singh 2018년 2월 26일
While using the line function try to mention the marker as the input to the function,
e.g:
h_plot = line(x,y,'Marker','o')
And then try to access the hMarkers =
get(h_plot,'MarkerHandle');
  댓글 수: 1
Lothar Löwer
Lothar Löwer 2018년 2월 27일
Thank's for the reply. Last week I tried the proposed way too, without any effect.
Nevertheless, I solved the problem using the scatter function. So far, I didn't know this plotting routine:
scatter(x,y,[],linspace(1,10,size(x)));

댓글을 달려면 로그인하십시오.


Paul Smits
Paul Smits 2019년 4월 4일
Matlab optimisation somehow destroys proper marker definitions.
Hack-solution: pause between creating the plot and fetching the markers.
h_plot = line(x,y);
pause(0.0000000001);
hMarkers = get(h_plot,'MarkerHandle');

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by