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

조회 수: 12(최근 30일)
Chris F
Chris F 2018년 5월 18일
댓글: Chris F 2018년 5월 18일
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
Chris F
Chris F 2018년 5월 18일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

jonas
jonas 2018년 5월 18일
편집: jonas 2018년 5월 18일
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))
  댓글 수: 1
Chris F
Chris F 2018년 5월 18일
That'll do it. I wrestled with those labels waaaay more than necessary... Thank you.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by