how to get a color bar like shown in figure??

1 回表示 (過去 30 日間)
SHANMUKHA REDDY AMARAVADI
SHANMUKHA REDDY AMARAVADI 2018 年 10 月 12 日
再開済み: SHANMUKHA REDDY AMARAVADI 2018 年 10 月 15 日
i need a log colorbar as in figure attached. how to get that

回答 (2 件)

KSSV
KSSV 2018 年 10 月 12 日
cb = colorbar();
cb.Ruler.Scale = 'log';
cb.Ruler.MinorTick = 'on';
  2 件のコメント
SHANMUKHA REDDY AMARAVADI
SHANMUKHA REDDY AMARAVADI 2018 年 10 月 15 日
I forgot to mention that my data also has negative values. cb.Ruler.Scale='log'; is showing an error. I am using Matlab 2016b. my data is of large range from negative to positive. axis.Ticks range is -150000 to 100000, so when I use logspace it is only giving '0' and 'inf'.
SHANMUKHA REDDY AMARAVADI
SHANMUKHA REDDY AMARAVADI 2018 年 10 月 15 日
編集済み: SHANMUKHA REDDY AMARAVADI 2018 年 10 月 15 日
I don't know why, but your solution didn't work for me, may be my question should be a bit more informative. I have the solution now. thank you very much for the response.

サインインしてコメントする。


SHANMUKHA REDDY AMARAVADI
SHANMUKHA REDDY AMARAVADI 2018 年 10 月 15 日
編集済み: SHANMUKHA REDDY AMARAVADI 2018 年 10 月 15 日
c=logspace(min(ax1.Ticks), max(ax1.Ticks), ceil(max(ax1.Ticks)));
c1= linspace((-1)*floor(log10(abs(min(ax1.Ticks)))), ceil(log10(max(ax1.Ticks))), 6);
j=1;
for i=1:length(c1)
if c1(i) > 0
c1_Positive(j,1)=c1(i);
j=j+1;
else
c1_Negative(i,1)=abs(c1(i));
end
end
labels1=arrayfun(@(c1_Negative) ['-10^',int2str(c1_Negative)],c1_Negative,'uniformoutput',false);
set(ax1,'TickLabels',labels1);
hold on;
labels2=arrayfun(@(c1_Positive) ['10^',int2str(c1_Positive)],c1_Positive,'uniformoutput',false);
set(ax1,'TickLabels',labels2);
I am trying to display the values as 10^ for some of them and -10^ for remaining. but I am unable to do that at a time. can anyone help me?? thanks in advance.

カテゴリ

Help Center および File ExchangeColorbar についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by