One common Y-axis label for two or more plots

4 次查看(过去 30 天)
Hello,
How can I get just one Y-Axis Label to span two or more plots? That is, center the Y-axis label between the plots in the rows?
Here is my code:
FigH = figure;
subplot(2,1,1); subplot(2,1,2);
AxesH = findobj(FigH, 'Type', 'Axes');
YLabelHC = get(AxesH, 'YLabel');
YLabelH = [YLabelHC{:}];
set(YLabelH, 'String', 'Y-label')
TitleHC = get(AxesH, 'Title');
TitleH = [TitleHC{:}];
set(TitleH, 'String', 'The title');

采纳的回答

Madhu Govindarajan
Madhu Govindarajan 2015-11-13
I would propose you to get the Handle of the subplots and then work with that.
Sample code
FigH = figure;
SP1H = subplot(2,1,1);
SP2H = subplot(2,1,2);
YLabel1H = get(SP1H,'YLabel');
set(YLabel1H,'String','YLabelThatIWant');
set(YLabel1H,'Position',[-0.0542 0 0]);
Title1H = get(SP1H,'Title');
set(Title1H,'String','TheTitleThatIWant');
HTH

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by