removing some data in a 4d plot
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
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;
0 个评论
更多回答(1 个)
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;
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Scatter Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!