0
$\begingroup$

I have a ListPlot of 4 data sets (tables) and I want to manually choose what color each one has.

data1 = Table1
data2 = Table2

etc.

and then

ListPlot[{data1,data2...},PlotRange-> Automatic]

This just gives 4 random colors for each data set. Can I somehow choose each color myself?

$\endgroup$
0
$\begingroup$

You can set the colours with the option PlotStyle, for example:

ListPlot[{data1, data2, data3, data4}, PlotRange -> Automatic,
         PlotStyle -> {Green, Red, Blue, Yellow}]

This makes the first set green, the second one red, the third one blue, and the fourth one yellow.

There are also other things you can change, e.g. the size of the points:

ListPlot[{data1, data2, data3, data4}, PlotRange -> Automatic,
        PlotStyle -> {Directive[Green, PointSize[0.1]],
                      Directive[Red, PointSize[0.05]],
                      Directive[Blue, PointSize[0.01]],
                      Directive[Yellow, PointSize[0.07]]}]

The Directive makes both specifications (colour and point size) to apply to the same data set.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Works, thank you! $\endgroup$ – PhysNerd90 Mar 18 '15 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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