set same ylim for all subplot (plot yy)

조회 수: 11 (최근 30일)
Marzuki Marzuki
Marzuki Marzuki 2021년 7월 5일
편집: Chunru 2021년 7월 5일
I have 21 subplot of yyplot. I want to set same ylim and YTick for all subplots. I tried the following code: set(findobj(gcf,'type','axes'),'FontName','Arial','FontSize',10, 'LineWidth', 1,...
'XTick',[0 3 6 9 12 15 18 21 23],'YTick',[0 0.2 0.4 0.5]);
It works only for second- y axis.
Thank you for sharing.

답변 (1개)

Chunru
Chunru 2021년 7월 5일
편집: Chunru 2021년 7월 5일
%% yyaxis plot
x = linspace(0,10);
y = sin(3*x);
yyaxis left
plot(x,y)
z = sin(3*x).*exp(0.5*x);
yyaxis right
plot(x,z)
ylim([-150 150])
% Set the ytick individually
h = gca;
h.YAxis(1).TickValues = -1:.5:1;
h.YAxis(2).TickValues = -150:30:150;

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by