필터 지우기
필터 지우기

How to create large figure from GUI axes?

조회 수: 2 (최근 30일)
Johnny Birch
Johnny Birch 2018년 12월 16일
댓글: Rik 2018년 12월 16일
Hi guys
I have a very simple GUI made in guide where i have a plot function initiated by a pushbutton which plots a scatter plot in axes (called Method1axes1):
handles.plot = scatter(X,Y, 'parent', handles.Method1axes1);
Now I want the user to be able to click the axes (plot) to get en new larger figure. I tried the below code which is working if i DON'T plot in the axes first. As soon as I run the plot function the scatterplot appears in Method1axes1 but I can no longer click the figure.
% --- Executes on mouse press over axes background.
function Method1axes1_ButtonDownFcn(hObject, eventdata, handles)
figure
scatter(X,Y);
What am I doing wrong?

답변 (1개)

Rik
Rik 2018년 12월 16일
Many functions that place content in an axis will reset a lot of properties. As an example: imshow will wipe most properties of its parent axis, while the image function will not. One of the properties that is removed often is the ButtonDownFcn (along with the other interaction callbacks), so you should check if that property is still as it should be.
You can try to prevent this by using hold on (or setting the NextPlot property of your axes obect), or setting the callback property every time you plot your data.
  댓글 수: 2
Johnny Birch
Johnny Birch 2018년 12월 16일
Hi Rik
i can get it to work. I am a novice i matlab programming, so maybe I am doing it wrong gow would you write your auggestions into my code?
Rik
Rik 2018년 12월 16일
You wrote some code. What did you write exactly? Which of my two suggestions did you try?
Also, please don't post the entire code in a comment, but attach it as an m-file. GUIDE makes for extremely bloaty code.

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

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by