Common Y label for multiple subplots in MATLAB!!!
86 次查看(过去 30 天)
显示 更早的评论
Can anyone please help, how to put common y label for multiple subplots in MATLAB figures?
0 个评论
采纳的回答
KSSV
2016-12-22
figure;
h1=subplot(2,1,1);
h2=subplot(2,1,2);
p1=get(h1,'position');
p2=get(h2,'position');
height=p1(2)+p1(4)-p2(2);
h3=axes('position',[p2(1) p2(2) p2(3) height],'visible','off');
h_label=ylabel('test','visible','on');
4 个评论
Eric Sargent
2020-10-22
t = tiledlayout(2,2);
t.YLabel.String = 'My y-Axis Label';
t = tiledlayout(2,2);
ylabel(t,'My y-Axis Label');
Victoria Dutch
2020-11-30
How would you make this work when using yyaxis? Both my y-labels are showing up on top of each other on the left, and I need one on the left and one on the right, but both vertically centered?
更多回答(1 个)
He Zhu Zhu
2019-11-15
If you used common Y label for multiple subplots, you might need to link the axes. The simplest way to do this is linkaxes function. Linked axes will behave synchronously when using pan or zoom tools.
ax1 = subplot(1, 2, 1);
ax2 = subplot(1, 2, 2);
linkaxes([ax1, ax2], 'y');
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!