[?] Give a different color to each point in a plot of points?

Posted 4 years ago
5235 Views
|
4 Replies
|
3 Total Likes
|
 Hello everyone, I'm new in mathematica so I have had some problems with it :/ . I have to make a plot from a science data in a 3D plot using points, and I have to give to each point a different color... and that's where is my issue. I've been trying with this colorfunc = ColorData["Rainbow"]; norm = (vels - Min[vels])*1000; (*Some of the velocities are <0 so I plus them a value to avoid this.*) cs = Normalize[norm]; Graphics3D[{PointSize[0.005], colorfunc@#[], Point[#[]]} & /@ Transpose[{cs, coord}], Axes -> True] where coord is a 3D list of points (x,y and z cords),vels is a list with velocities, cs is the list containing the data for the colors. My problem is that when I execute the code the graph that I get has all the points with pretty similar colors, and I already know that I should see a difference between them, so I'm asking you for help with this. How should I give a different color to each point in such a way that I can see the difference between each point? Thank you. Answer
4 Replies
Sort By:
Posted 4 years ago Answer
Posted 4 years ago
 If you index your points by i you could use ColorData[I] for your colorfunc. This gives a distinctly different color for adjacent points on the list but the colors are pretty much random. Look at the Color Schemes palette, 97 under Indexed. This is, by the way, what Mathematica uses for coloring successive curves when plotted in a single Plot statement. Answer
Posted 4 years ago
 It works, I thank you very much :). Answer
Posted 4 years ago
 Hi,try cs = (norm/Max[norm]); Cheers,Marco Answer