フィルターのクリア

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 Center および File ExchangeInteractive 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