How do I make plot a 3D matrix as a scatter plot with color based on value?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Suppletory
am 17 Nov. 2016
Beantwortet: michio
am 17 Nov. 2016
I have a 3D matrix cube(i,j,k) and I want to plot the points as a scatter plot. However, each point is a different temperature and I would like to color each point based on the temperature.
The result would be a cube i by j by k with i*j*k points and each point would vary in color based on the value assigned to the point.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 17 Nov. 2016
[X,Y,Z] = ndgrid(1:size(cube,1), 1:size(cube,2), 1:size(cube,3));
pointsize = 30;
scatter3(X(:), Y(:), Z(:), pointsize, cube(:));
0 Kommentare
Weitere Antworten (1)
michio
am 17 Nov. 2016
scatter3 allows you to specify color. Please have a look at the example code on the doc page.
scatter3(X,Y,Z,S,C)
draws each circle with the color specified by C, where C is a vectorized cube(i,j,k) with length equal to the length of X, Y, and Z. Then the values in C are linearly mapped to the colors in the current colormap.
If you have trouble applying scatter3 to your data, please let me know with the detailed situation.
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!