removing some data in a 4d plot
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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;
0 Kommentare
Akzeptierte Antwort
DGM
am 12 Mai 2022
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;
0 Kommentare
Weitere Antworten (1)
Chunru
am 12 Mai 2022
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;
0 Kommentare
Siehe auch
Kategorien
Mehr zu Scatter Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!