How do I turn on (make visible) Major Tick Labels on a logarithmic Colorbar?

16 views (last 30 days)
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
jonas
jonas on 18 May 2018
Edited: jonas on 18 May 2018
Sorry, I'm not able to run that code as there is no colorscale property connected to the axis (2017a). What version are you running?
Even the staff team seems a bit confused over this, (link)
Chris F
Chris F on 18 May 2018
Version 2018a. When I inserted the code that "if true, end" text wrapped itself around; maybe that's the issue running it?
I've attached a .jpg and .fig image of the plot. Hope that helps showing the every other tick labels.

Sign in to comment.

Accepted Answer

jonas
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)

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!