How do I turn on (make visible) Major Tick Labels on a logarithmic Colorbar?
16 views (last 30 days)
Show older comments
The tick marks themselves are set on the colorbar. However, only every other mark is labeled with the appropriate 10^x. How do I get these in-between labels to appear?
To be clear, my current work spans over ten of these labels. I can visually see eight major log tick marks on the color bar, plus the colorbar's min and max values. The lowest extreme is labeled (by default; I didn't make this happen) and moving up the colorbar only every other major tick is labeled. Only five labels exist on the colorbar, but I would like to see ten.
Preferably, I'd like to generalize the code such that if my numbers only go across six major log ticks or even fourteen log ticks that MATLAB will display all necessary major tick labels.
4 Comments
Accepted Answer
jonas
on 18 May 2018
Edited: jonas
on 18 May 2018
So, finally finished installing latest release. Try setting the ticks manually and it should work. For the example given in the comments:
if true
x = [4e7, 5e11, 9e17];
y = [5e8, 4e11, 8e17];
z = [3e8, 6e11, 7e17];
average = (x+y+z)/3;
markersize = 99;
C = average;
color = C(:); %Vary color by value of average
scatter3(x,y,z,markersize,color,'Filled')
cb=colorbar
set(gca,'ColorScale','log')
caxis([min(x),max(x)]); %set value range of colorbar
end
set(cb,'ticks',10.^(8:20))
More Answers (0)
See Also
Categories
Find more on Colormaps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!