removing some data in a 4d plot

2 ビュー (過去 30 日間)
Hamid Basiri
Hamid Basiri 2022 年 5 月 12 日
回答済み: Chunru 2022 年 5 月 12 日
Hi every one,
I have a 4d plot and want to make some limitation for the 4th dimention of my graph. For example if the value is higher than 0.9 plot otherwise ignore that point. I am using scatter3(x,y,z,10,teta,'filled') and I attached the sample input file.
I did the limitation using teta(teta>0.9)=[];
And the error I faced is:
Error using scatter3
Color must be one RGB triplet, an m-by-3 matrix of RGB triplets with one color per scatter point, or an m-by-1 vector with one value
per scatter point.
cla
load 4dplot.txt
x = 4dplot(:,1);
y = 4dplot(:,2);
z = 4dplot(:,3);
teta = 4dplot(:,4);
scatter3(x,y,z,10,teta,'filled')
ax = gca;
ax.XDir = 'reverse';
view(-31,14)
cb = colorbar;

採用された回答

DGM
DGM 2022 年 5 月 12 日
You have to apply the same operation to all of the vectors.
load 4dplot.txt
x = X4dplot(:,1);
y = X4dplot(:,2);
z = X4dplot(:,3);
teta = X4dplot(:,4);
goodpts = teta <= 0.9;
scatter3(x(goodpts),y(goodpts),z(goodpts),10,teta(goodpts),'filled')
ax = gca;
ax.XDir = 'reverse';
view(-31,14)
cb = colorbar;

その他の回答 (1 件)

Chunru
Chunru 2022 年 5 月 12 日
data = load('4dplot.txt');
% x = 4dplot(:,1); % wrong: variable names canno start with number
x = data(:,1);
y = data(:,2);
z = data(:,3);
teta = data(:,4);
idx = teta >= 0.9;
scatter3(x(idx),y(idx),z(idx),10,teta(idx),'filled')
ax = gca;
ax.XDir = 'reverse';
view(-31,14)
cb = colorbar;

カテゴリ

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

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by