XGrid

조회 수: 56 (최근 30일)
Nicolas
Nicolas 2011년 8월 19일
Hi,
I'm looking to set up the Xgrid on but only for the zero value,
i wrote that
set(gca,'XTick',0,'XGrid','on')
but only zero is tick on the figure, maybe the other way would be to plot a vertical line for x =0, but how do I choose y to be the min and max of my figure instead of my data ?
Cheers

채택된 답변

Daniel Shub
Daniel Shub 2011년 8월 19일
plot([0, 0], [min(ylim), max(ylim)], 'k:');

추가 답변 (1개)

Nicolas
Nicolas 2011년 8월 19일
ylim=ylim(subplot(4,5,j));
yMinor=linspace(ylim(1),ylim(2),length(s(:,1)));
p=zeros(1,length(s(:,1)));
plot(p,yMinor,'--k')
  댓글 수: 1
Daniel Shub
Daniel Shub 2011년 8월 19일
In general it is bad practice to use function names as variable names as is done here with ylim=ylim( ...
For your own sanity later call ylim something else.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by