Colour points in 2d or 3d based on value of another vector
1 view (last 30 days)
Elliot Ferguson on 30 Aug 2022
I have several parallel vectors of data and I have been plotting them against each other in various ways to determine relationships and develop a model. One thing I would like to do is make a plot with each point coloured based on a further quantity, namely temperature. I have tried experimenting with colormap functions but haven't yet managed to find a satisfactory compact solution.
Something similar to this is what I am going for, it seems much simpler to do with matplotlib.
The temperatures range from roughly 40-100 so 40 should be classed as 'cold' and at the blue end, etc. I am looking for a solution for both 2d and 3d plots as I will be working with both of these.
Cris LaPierre on 30 Aug 2022
Edited: Cris LaPierre on 30 Aug 2022
x = linspace(0,3*pi,200);
y = cos(x) + rand(1,200);
c = linspace(40,100,length(x));
You could follow a similar approach using scatter3. The only difference is specifying X,Y and Z. You can find some examples here.
z = cos(x) + rand(1,200);