필터 지우기
필터 지우기

Change units of colorbar

조회 수: 5 (최근 30일)
ARP
ARP 2019년 3월 12일
댓글: ARP 2019년 3월 26일
Hi,
How can I change the units of the colorbar? The image has units in the logarithm scale. I would like to show the tick labels of the colorbar in the linear scale.
The tick labels in the colorbar display show (-1.5, -1, -0.5, 0, 0.5, 1). I would like to chage them to the linear scale, (0.03,0.10,0.32,1.00,3.16,10.00).
Is thre a way to do that without affecting the interval of the image? I have tried with c. Limits = [10^(-1.6) 10^(1.2)]. It does the job on chaging the scale bar, but also changes the image to the linear scale. I don't mind to write it manually, but how to do it?.
I also tried as in the example colorbar doc, but returns : Index exceeds matrix dimensions.
c('Ticks', [-1.5,-1,-0.5,0,0.5,1],'Ticklabels',[0.03,0.10,0.32,1.00,3.16,10.00]);
Here is the code for the image:
imagesc(x_axis,distance_subset,log10(AV_c_3(1:end,:)),[-1.6 1.2]);
colormap(jet);
c = colorbar('location', 'SouthOutside');
axis image
xlabel('Lateral length (mm)')
ylabel('Depth (mm)')
Thanks in advance

답변 (1개)

Naman Bhaia
Naman Bhaia 2019년 3월 21일
Hello Andres,
What I understood from your question is that you just want to change the X-axis labels. Since you said that you are willing to do it manually, have a look at this link and see if it helps.
  댓글 수: 3
Image Analyst
Image Analyst 2019년 3월 26일
The help for colorbar() has an example showing you how to change the tick labels:
contourf(peaks)
colorbar('Ticks',[-5,-2,1,4,7],...
'TickLabels',{'Cold','Cool','Neutral','Warm','Hot'})
ARP
ARP 2019년 3월 26일
Yes thanks, that is were I looked in first place.
That is why I tried: ( change colobar units from the logarithm to linear scale)
c = colorbar('location', 'SouthOutside');
c('Ticks', [-1.5,-1,-0.5,0,0.5,1],'Ticklabels',[0.03,0.10,0.32,1.00,3.16,10.00]);
And returns the following error:
Index exceeds matrix dimensions.
Error in comparison_short_vs_long (line 603)
c('Ticks', [-1.5,-1,-0.5,0,0.5,1],'Ticklabels',[0.03,0.10,0.32,1.00,3.16,10.00]);

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

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by