Logarithmic scale for colorbar

233 ビュー (過去 30 日間)
Tom 2015 年 4 月 15 日
コメント済み: Walter Roberson 2020 年 4 月 27 日
I sometimes require a plot which has a colorbar with a log scale. Previously I did this by setting the 'yscale' property of the underlying colorbar axes, but this no longer works with the new graphics system. Is there a workaround for the new system?


Jonathan Campelli
Jonathan Campelli 2015 年 4 月 15 日
Hello Tom,
My script plots sample data in logscale using "countourf", and both "YTick" and "YTickLabel" are set in "colorbar" on the last line:
c=[1 10/3 10 100/3 100 1000/3 1000 10000/3 10000];
colormap(bone); %Color palate named "bone"
caxis(log([c(1) c(length(c))]));
If this code does not meet your needs, let me know, and I will develop a more appropriate solution,
Best regards,
Jonathan Campelli
  2 件のコメント
Bo Wang
Bo Wang 2020 年 4 月 27 日
its a really nice answer to me , thanks !


その他の回答 (1 件)

Xiaolong 2020 年 3 月 26 日
  1 件のコメント
Walter Roberson
Walter Roberson 2020 年 4 月 27 日
Note: that was not available at the time the question was originally asked.


Community Treasure Hunt

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

Start Hunting!

Translated by