How do I turn on (make visible) Major Tick Labels on a logarithmic Colorbar?
조회 수: 16 (최근 30일)
이전 댓글 표시
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
채택된 답변
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))
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Colormaps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!