1
$\begingroup$

I would like to plot/scatter a few points, but each of them should be in different color. I need this, because color should store extra information, let's say OX means age, OY means hight and color of point indicates a person. Is it possible to do? Thanks for any help

Edit: Solved. Thank you for your answers. I decided to create ListPlot and treat every point as seperate plot, because it's important for me to remember which point represents which "person".

$\endgroup$
2
  • $\begingroup$ often simplest to just use graphics directives for this, see Graphics,Point $\endgroup$
    – george2079
    Commented Apr 12, 2017 at 19:06
  • $\begingroup$ So do you want each one in different color or do you want the color to reflect already existing values? \ $\endgroup$
    – Kuba
    Commented Apr 12, 2017 at 19:23

2 Answers 2

3
$\begingroup$

All the same colour

ListPlot[MapIndexed[{#2[[1]], #1} &, Prime[Range[25]]]]

All different colours

ListPlot[MapIndexed[List@{#2[[1]], #1} &, Prime[Range[25]]]]

enter image description here

$\endgroup$
1
$\begingroup$

Suppose you have some list of points:

data = Table[{i, Random[]}, {i, 0, 10}];

Then

ListPlot[Flatten[{data}, {2}], PlotStyle -> PointSize[Large]]

gives you what you want:

enter image description here

You can use PlotStyle to define the color to be used.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.