필터 지우기
필터 지우기

One common Y-axis label for two or more plots

조회 수: 4 (최근 30일)
monkey_matlab
monkey_matlab 2015년 11월 13일
답변: Madhu Govindarajan 2015년 11월 13일
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