Usage of a single color while plotting using scatter3

Hi, I am trying to plot a four dimensional array using scatter3 command. My interest is to show one of the dimension varying the intensity of the same color e.g. light red to dark red. However I am not yet successful. I have attached my code below.
clear, clc;
i=importdata('wp1_param.txt')
p=i.data(:,1);
x=i.data(:,2);
y=i.data(:,3);
z=i.data(:,4);
data = [x;y;z]
c = [1:31]
colorbar
scatter3(x,y,z,100,p','filled')
A solution to the above problem will be highly appreciated.
Thanks

 採用された回答

Walter Roberson
Walter Roberson 2016 年 6 月 14 日

0 投票

No problem here in my test:
p = sort(rand(50,1));
x = linspace(10,30,50).';
y = logspace(1,sqrt(2),50).';
z = sqrt(x.^2 + y.^2);
scatter3(x,y,z,100,p,'filled')
There was one recent release in which the colors of scatter markers could be wrong; see http://www.mathworks.com/matlabcentral/answers/242962-legend-entries-all-same-color-in-matlab-2015b if you are using R2015b.

2 件のコメント

Skot
Skot 2016 年 6 月 14 日
Thanks Walter for the quick reply, but it didn't work here. I am using 2016a. Best
Walter Roberson
Walter Roberson 2016 年 6 月 14 日
When you say that it did not work, what output did you get? I have attached what I get.
What does
opengl info
return for you? Do you happen to be using an Intel HD2000 graphics card?

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGraphics Performance についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by