Colorbar Minor Tickmarks with 2014b
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I used to be able to turn on minor tickmarks on colorbars prior to version 2014b using the command
set(h_cbar, 'YMinorTick', 'on');
Now, however, I get an error when I run this. Looking through the list of properties for the colorbar, I can't find any way to add minor tick marks to a colorbar. I can add unlabeled tick marks, but they have the same length as the major tick marks.
As an example, the following code run in v. 2012a adds minor tick marks to the figure.
h_f = figure;
h_p = plot(9:20,9:20);
h_c = colorbar;
set(h_c,'YMinorTick','on')
When the same code is run in v. 2014b, I get the error:
Error using matlab.graphics.illustration.ColorBar/set
There is no YMinorTick property on the ColorBar class.
Is there any way to create minor tick marks in v. 2014b, or is it completely lost?
1 commentaire
Star Strider
le 8 Déc 2014
It’s likely gone but not completely lost. I’m hoping a number of currently inaccessible properties in HG2 (that were available in previous versions) magickally reappear next year.
Meanwhile, submit a Support Request asking how to enable the minor ticks in R2014b. There might be an undocumented method.
Réponse acceptée
matt dash
le 8 Déc 2014
I don't see it hidden anywhere. Incidentally there is a hidden "Axes" property, but it returns the axes the colorbar is linked to, not the colorbar itself.
Potential workaround: create a new axes on top of the colorbar, and set ITS minor ticks. Use axes('color','none') to get a transparent background so you can otherwise see the colorbar behind it.
Plus de réponses (1)
Yair Altman
le 9 Déc 2014
h_c.Ruler contains properties that support minor-ticks: MinorTick, MinorTicks and MinorTickVisible (='off' by default). The problem is that for some reason MathWorks have set the MinorTicks property as read-only so it cannot be changed from its default value of empty, so regardless of whether MinorTickVisible is on/off, no minor ticks are displayed.
Still, the availability of these properties probably mean that there's a good chance that they will be enabled in some future Matlab release. If you ask MathWorks support for this, it could help increase the likelihood of this.
0 commentaires
Voir également
Catégories
En savoir plus sur Colorbar dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!