フィルターのクリア

Odd minor grid behavior

1 回表示 (過去 30 日間)
Rob Campbell
Rob Campbell 2019 年 4 月 17 日
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
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
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 件)

カテゴリ

Help Center および File ExchangeTime Series Objects についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by