How do I create a logarithmic colorscale on a scatter3 colorbar in version 2016a?

7 ビュー (過去 30 日間)
Chris F
Chris F 2018 年 5 月 21 日
コメント済み: jonas 2018 年 5 月 21 日
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')
colorbar
set(gca,'ColorScale','log') %%%%%%This is where the problem lies
caxis([min(x),max(x)]); %set value range of colorbar
I've learned the set(gca,'ColorScale','log') will not work in 2016a; error: There is no ColorScale property on the Axes class. Is there any simple way of dictating the colorbar to be logarithmic? Any help is appreciated.
  1 件のコメント
jonas
jonas 2018 年 5 月 21 日
Not the most elegant solution but you can always rescale the data and manipulate the ticklabels.

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

採用された回答

Walter Roberson
Walter Roberson 2018 年 5 月 21 日
In R2016a, you can
cb = colorbar;
cb.DataSpace.YScale = 'log';
However, this will be ignored and it will retain linear.
... and that is the only control you have in R2016a, other than creating your own color bar similar to the way it was done in HG1: create an axes and draw an image (or patch) in it.

その他の回答 (0 件)

カテゴリ

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