Effacer les filtres
Effacer les filtres

Odd minor grid behavior

1 vue (au cours des 30 derniers jours)
Rob Campbell
Rob Campbell le 17 Avr 2019
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.

Réponses (0)

Catégories

En savoir plus sur Time Series Objects dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by