plot over writing on gui
이전 댓글 표시
I have a GUI that calls a plot function (via a timer) that plots in a separate figure. Occasionally the plot overlays the GUI. I am plotting to the axes, so this should not happen. Example:
plot(hAxes(i), XData, YData);
Here is a repeatable scenario: The timer is repeatedly plotting on a given axes, when I press a UI button, the GUI gets overlaid with the plot just as or before the callback is executed. (I put a dbstop at the beginning of the callback. The GUI would still be overwritten even without the dbstop. It's as if ML gets confused when the GUI figure is made current, even though the plot axes is specified.
Any ideas?
댓글 수: 4
Geoff Hayes
2015년 6월 4일
Jerry - can you post/attach more of your code? Is the line
plot(hAxes(i), XData, YData);
the only place in the code where you call plot?
Adam
2015년 6월 4일
Since you have a breakpoint at the key location have you looked at
hAxes(i)
on the command line at that moment to ascertain whether it is a valid axis handle and the one you expect. If it isn't a valid axis handle then it may just default to creating a new axes on the current figure (I'm not 100% sure because obviously I try to avoid ever being in the situation of plotting to a dead axes handle).
Jerry Gregoire
2015년 6월 4일
Adam
2015년 6월 5일
Yes, I have been caught by that a few times. hold off will create an axes specially to turn their hold status off if it doesn't have an active axes on the current figure!
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!