Effacer les filtres
Effacer les filtres

How to create large figure from GUI axes?

2 vues (au cours des 30 derniers jours)
Johnny Birch
Johnny Birch le 16 Déc 2018
Commenté : Rik le 16 Déc 2018
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?

Réponses (1)

Rik
Rik le 16 Déc 2018
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 commentaires
Johnny Birch
Johnny Birch le 16 Déc 2018
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 le 16 Déc 2018
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Tags

Produits


Version

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by