Odd minor grid behavior
1 次查看(过去 30 天)
显示 更早的评论
Hi all:
I recently tried to use minor grids to set up lines around cells in a scaled color image, and have not been able to get it to work, I'm getting lines on the major ticks too. Here's an example:
t=rand(10);
figure
imagesc(t)
xl=xlim;
ax=gca;
ax.YAxis.MinorTickValues=[xl(1)+1:1:xl(2)-1];
ax.XAxis.MinorTickValues=[xl(1)+1:1:xl(2)-1];
set(ax,'yminorgrid','on','xminorgrid','on','minorgridlinestyle','-')
...that gives me a plot like this:
![imagesc_weirdness.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/214604/imagesc_weirdness.png)
I've tried toggling the major grid with 'grid', setting the major grid linestyle to 'none', neither will get rid of the lines on the major ticks.
The same behavior occurs with a simple plot:
t=rand(10,2);
figure
plot(t(:,1),t(:,2),'k.')
ax=gca;
ax.XLim=[0 1]; ax.YLim=[0 1];
ax.YAxis.MinorTickValues=[0.05:0.1:0.95];
ax.XAxis.MinorTickValues=[0.05:0.1:0.95];
set(ax,'yminorgrid','on','xminorgrid','on','minorgridlinestyle','-')
produces this:
![plot_tick_weirdness.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/214605/plot_tick_weirdness.png)
Is there something I'm not understanding about the minor grid behavior? Is there a way to have just the minor grid showing? I've verified this occurs in R2017b and R2019a.
I have a workaround using a for loop to draw lines, but I'm curious to know why this is happening.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series Objects 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!