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:
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:
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개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!