how to change figure properties?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I opened two figures and I gave them names. I would like to change their properties not directly after I created them but a posteriori.
Here is an example of what I try to do:
fig1 = figure;
plot(1:10,1:10,'r+');
fig2 = figure;
plot(1:10,-1:-1:-10,'b+');
set(fig1,'xlabel','position')
But I get the error "The name 'xlabel' is not an accessible property for an instance of class 'figure'."
What should I do to have it working?
Thanks
Guillaume
0 Commenti
Risposta accettata
Adam
il 18 Ago 2014
Modificato: Adam
il 18 Ago 2014
xlabel is a property of the axes, not the figure
(I assume that is enough for you to solve the problem, if not I can expand it!)
3 Commenti
Adam
il 18 Ago 2014
Modificato: Adam
il 18 Ago 2014
There are a few ways you can do it, but maybe simplest is just something like:
fig1 = figure; axes1 = gca;
plot(1:10,1:10,'r+');
fig2 = figure; axes2 = gca;
plot(1:10,-1:-1:-10,'b+');
set(axes1,'xlabel','position')
I think that should work, though I don't have time right now to test it.
The other way that comes to mind is finding the axes as a child of the figure. but that is more complicated and not necessary when you can just store the axes handle.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Specifying Target for Graphics Output in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!