MATLAB: How to add different color for each galaxy

3dplotcolorsimulation

I am working on "Spiral Galaxy Formation Simulation" example in Mathworks. How can I add different colors for each galaxy's bodies? There is an option in each galaxy function for color but it doesn't work.

Best Answer

Use scatter3() instead of plot3() if you want to specify a color for each and every marker.