How to plot color indication on the points in 2D and 3D
4 ビュー (過去 30 日間)
古いコメントを表示
I have a set of data looks like this
X Y Z Intensity
-10 -10 15 100
-10 -10 16 200
-9 -10 15 150
-9 -10 16 130
-8 -10 15 110
-8 -10 16 117
-10 -9 15 210
-10 -9 16 189
-9 -9 15 234
-9 -9 16 156
-8 -9 15 175
-8 -9 16 183
-10 -8 15 216
-10 -8 16 260
-9 -8 15 144
-9 -8 16 190
-8 -8 15 128
-8 -8 16 219
The actual data file is much bigger. In the X-Y plane, I was trying to plot the color indication with the given Intensity for a fixed point in Z.
And is it possible that i cant plot a 3D view with the color indications using the current fields of data that I've.
I had tried to looked up on colormap, surf functions, but I don't know how to use them correctly.
Thanks
0 件のコメント
採用された回答
Walter Roberson
2015 年 9 月 18 日
pointsize = 20;
scatter3(x(:), y(:), z(:), pointsize, intensity(:));
You can take subsets of the data for particular z, if you want. For example
idx = z == 16; %watch out for floating point comparisons if the values are not integers!
scatter3(x(idx), y(idx), z(idx), pointsize, intensity(idx));
3 件のコメント
Walter Roberson
2015 年 9 月 18 日
gridsize = 36; %adjust as needed
constant_z = 15; %adjust as needed
minvals = min(XYZI, 1);
maxvals = max(XYZI, 1);
[X,Y,Z] = meshgrid( linspace(minvals(1),maxvals(1),gridsize), linspace(minvals(2),maxvals(2),gridsize), constant_z);
Vq = griddata(XYZI(:,1), XYZI(:,2), XYZI(:,3), XYZI(:,4), X, Y, Z);
surf(X, Y, Z, Vq);
and you can look at the same thing after doing
view([0 90])
You might notice that the 3D image is "flat". You wrote earlier "I was trying to plot the color indication with the given Intensity for a fixed point in Z." Fixed point in Z implies flat.
If you remove the restriction about "fixed point in Z" then to get a 3D graph you need to ask whether there is only one Z for each unique (X,Y) pair, because if so then the single Z can be used as the height. But your data is not unique in Z, only in (X,Y,Z). We therefore do not know which of the multiple Z to pick. We can invent solutions such as picking the Z that corresponds to the maximum intensity.
It looks as if possibly your data forms a cuboid, that you have a series of X, Y, and Z, and that you have intensity data for each combination of those. If that is the case then you should be considering slice() or isosurface() or considering voxel viewing
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!