One common Y-axis label for two or more plots
1 view (last 30 days)
Show older comments
monkey_matlab
on 13 Nov 2015
Answered: Madhu Govindarajan
on 13 Nov 2015
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');
0 Comments
Accepted Answer
Madhu Govindarajan
on 13 Nov 2015
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 Comments
More Answers (0)
See Also
Categories
Find more on Title in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!