minor grid in consecutive plots

37 次查看(过去 30 天)
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...

请先登录,再进行评论。

更多回答(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