How can I create a 3D plot of data with dots of different color?
Show older comments
Hello everyone,
I have to create a 3D visualization of some data that I have. I have 2 vectors that represent mean and standard deviation of my data. I have to plot them in a 3d graph in which each point of the graph contains a pair of (mean,sd) value, and for each pair I have to draw a cloured point. The colour depends on the values of the mean (ex: red=high value, blu=low value).
Thank you, cordially
Carlotta
4 Comments
Turlough Hughes
on 19 Feb 2020
Do you have x, y, z coordinates corresponding to each of your means and standard deviations?
carlotta barbierato
on 19 Feb 2020
Adam Danz
on 19 Feb 2020
The question is still unclear. This is how I understand it so far. Please either confirm or correct the following steps or replace them completely with more descriptive ones.
- So, you have two nx1 (or 1xn) vectors: one for the means, one of the stds.
- And you have a nx3 (or 3xn) matrix of [x,y,z] coordinates.
- You want to create a scatter plot of the [x,y,z] coordinates in a 3D plot and color-code each point based on the mean value (the std values aren't used).
carlotta barbierato
on 19 Feb 2020
Accepted Answer
More Answers (2)
Mil Shastri
on 19 Feb 2020
0 votes
Check out this video starting from 18:04 https://www.mathworks.com/videos/matlab-for-excel-users-81634.html
At 19:04, Adam defines the color of the points. He also shows how you can have MATLAB automatically generate code for the customizations.
1 Comment
carlotta barbierato
on 19 Feb 2020
Sky Sartorius
on 19 Feb 2020
Use a scatter plot and CData:
n = 100;
xData = 1:n; % Placeholder - I assume you have additional information about the data to locate it in 3D space.
meanData = rand(n,1);
stdData = randn(n,1).^2;
scatter(xData,meanData,'CData',stdData);
h = colorbar;
h.Label.String = 'Standard deviation'
ylabel('Mean')
1 Comment
carlotta barbierato
on 19 Feb 2020
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!