Labelling several axes with the same name
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Daniel Shub
2012-5-3
Duplicate to http://www.mathworks.com/matlabcentral/answers/37239-labelling-several-axes-with-the-same-name
采纳的回答
Daniel Shub
2012-5-3
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 个)
Jan
2012-5-3
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 个评论
Daniel Shub
2012-5-3
No, get(H, 'XLabel') returns a cell array that set doesn't like. See my answer for one fix.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!