minor grid in consecutive plots

조회 수: 42 (최근 30일)
G A
G A 2021년 4월 9일
댓글: G A 2021년 4월 10일
If I run the following code (within a script or command window) several times, then the minor grids will be 'on' only every other time. Why?
x=-2*pi:0.1:2*pi;
y=sin(x);
figure(1)
hold on
plot(x,y);
grid on
grid minor

채택된 답변

Walter Roberson
Walter Roberson 2021년 4월 9일
grid minor toggles the visibility of the minor grid lines. Minor grid lines lie between the tick marks. Not all types of charts support minor grid lines.
You probably want
set(gca, 'XMinorGrid', 'on', 'YMinorGrid', 'on')
  댓글 수: 3
Walter Roberson
Walter Roberson 2021년 4월 10일
grid minor toggles the visibility of the minor grid lines
So the first time you call it, it turned it from default off to on. The second time you call it, it turns it off. The third time you call it, it turns it on...
G A
G A 2021년 4월 10일
Understood. Thanks!

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by