plot multiple variables with different colors
Show older comments
Hi,
I have 3 variables x,y,z; each of them are double numeric arrays and their size is 1x316(all same size.
I want to plot these 3 variables in a 3D graph using scatter3(or any) function where i need to plot each variable in different colors.
Lets say:
scatter3(x,y,z,'ro','bo','go');
but i am unable to plot these with different colors in a same graph.
Please help!
Thanks in advance!
9 Comments
Adam
on 12 Dec 2016
I don't understand what you mean by 'each variable in different colours'. Each point in a 3d plot will take one value from each of the 3 variables.
If you want each variable a different colour then you would seem to just one a basic 3 normal scatter plots instead of a single 3d scatter plot.
Adam
on 12 Dec 2016
Well, like I said, each point takes a value from each variable so how are you expecting the result to look with each variable its own colour in a 3d plot?
Walter Roberson
on 12 Dec 2016
Where in three space should the combination x(1), y(1), z(1) go? What color should the result have?
Jung BC
on 12 Dec 2016
Jung BC
on 12 Dec 2016
The colours in that example plot are not one per variable, they are just a colour split of the 3d data into 3 different divisions, but every point still has one element from each of the x, y and z variables, just that, for example, points with a radius less than 0.5 are blue, points with between 0.5 and 0.75 are green and points between 0.75 and 1 are yellow (as an example, I don't know what the exact delineation is for that plot).
You need to work out what you want conceptually and then work out how to do it in Matlab.
Walter Roberson
on 12 Dec 2016
Please answer my question. Give me a formula for where in 3d x(k),y(k),z(k) should go and what color the resulting point or points should be.
Accepted Answer
More Answers (0)
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!