Colorbar Minor Tickmarks with 2014b
8 次查看(过去 30 天)
显示 更早的评论
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 个评论
Star Strider
2014-12-8
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.
采纳的回答
matt dash
2014-12-8
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.
更多回答(1 个)
Yair Altman
2014-12-9
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colorbar 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!