필터 지우기
필터 지우기

how to plotyy axis equal

조회 수: 1 (최근 30일)
Hideki Kawakatsu
Hideki Kawakatsu 2018년 2월 3일
답변: vijaya lakshmi 2018년 2월 8일
hello, is there an equivalent code for AXIS EQUAL for plotyy ? My concern is that when I use grid on, the dashed lines are not superposed on left side axis and right side axis. So it seems I need to rebuild the tick labels to have the same spacing unit on left and right side axis ticks. Any suggestions ? yours

답변 (1개)

vijaya lakshmi
vijaya lakshmi 2018년 2월 8일
Hi Hideki,
I understand that you want to superimpose the dashed lines on both the Y-axes when using grid on.
The grid lines superimposes if the number of levels/divisions on both the Y-axes are same.
Try the following code snippet where the grid lines are superimposed
x = linspace(0,10);
y = sin(3*x);
z = sin(3*x).*exp(0.5*x);
[haxes,hline1,hline2] = plotyy(x,y,x,z);
set(haxes(2),'Xgrid','on')
set(haxes(2),'Ygrid','on')
set(haxes(1),'ylim',[-1 1])
set(haxes(2),'ylim',[-130 130])
set(haxes(2),'ytick',[-130:10:130])
% you can then for instance add a grid to the first axes as well
set(haxes(1),'ytick',linspace(-1,1,27))
set(haxes(1),'Xgrid','on')
set(haxes(1),'Ygrid','on')
If the number of levels are different, try adjusting the spacing between the levels

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by