MATLAB Answers


Logarithmic scale for colorbar

さんによって質問されました 2015 年 4 月 15 日
最新アクティビティ Troy Dion
さんによって コメントされました 2017 年 8 月 3 日
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?

  0 件のコメント

サインイン to comment.

1 件の回答

Answer by Jonathan Campelli on 15 Apr 2015
 Accepted Answer

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

  1 件のコメント

Troy Dion
2017 年 8 月 3 日
Is there a way to make this work with scatter3?

サインイン to comment.

Translated by