Effacer les filtres
Effacer les filtres

Labelling several axes with the same name

1 vue (au cours des 30 derniers jours)
David Polcari
David Polcari le 3 Mai 2012
I have a figure with four subplots. I would like the x-axis to be labelled as "position" for all of them. How can I do this with one line of code?
  1 commentaire
Daniel Shub
Daniel Shub le 3 Mai 2012
Duplicate to http://www.mathworks.com/matlabcentral/answers/37239-labelling-several-axes-with-the-same-name

Connectez-vous pour commenter.

Réponse acceptée

Daniel Shub
Daniel Shub le 3 Mai 2012
Building on Jan's answer ...
H(1) = subplot(1,2,1);
H(2) = subplot(1,2,2);
Htemp = get(H, 'XLabel');
set([Htemp{:}], 'String', 'position');
  1 commentaire
Daniel Shub
Daniel Shub le 3 Mai 2012
I missed the 1 line of code...

Connectez-vous pour commenter.

Plus de réponses (1)

Jan
Jan le 3 Mai 2012
H(1) = subplot(1,2,1);
H(2) = subplot(1,2,2);
set(get(H, 'XLabel'), 'String', 'position');
Does this work? I cannot test it currently.
  1 commentaire
Daniel Shub
Daniel Shub le 3 Mai 2012
No, get(H, 'XLabel') returns a cell array that set doesn't like. See my answer for one fix.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by