RE: Use color with ListPlot?
- To: mathgroup at smc.vnet.net
- Subject: [mg67928] RE: [mg67898] Use color with ListPlot?
- From: "David Annetts" <davidannetts at aapt.net.au>
- Date: Thu, 13 Jul 2006 06:53:35 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi Xiangdong,
> This must be a simple question. How do I make color plots
> using ListPlot?
>
> With continuous curve, one can do something like below to get
> a color plot.
>
> Plot[{Sin[x], Cos[x]}, {x, 0, 4Pi},
> PlotStyle->{{RGColorB[0,0,1], RGBColor[0,1,0]}}];
>
> (well, except that I don't see two colors (B and G) but only one (G)).
Apart from misspelling the first RGBColor, you have too many brackets. Try
Plot[{Sin[x], Cos[x]}, {x, 0, 4Pi}, PlotStyle -> {Blue, Green}];
The reason you'd need all those brackets, is to plot the functions with two
very different styles such as
Plot[{Sin[x], Cos[x]}, {x, 0, 4Pi},
PlotStyle -> {{Blue, Thickness[.01]},
{Green, Thickness[.015], Dashing[{.1,
.1}]}}
];
> With a list of dots that I want to connect, the following
> line only produces uncolored plot.
>
> ListPlot[{{1,2}, {4, 2}, {1,4}, {4, 2}}, PlotJoined->True,
> PlotStyle->{{RGBColor[0,0,1]}}];
Same problem -- too many brackets. Try
ListPlot[{{1, 2}, {4, 2}, {1, 4}, {4, 2}}, PlotJoined -> True,
PlotStyle->Blue];
Again, if you need very different plot styles, put the arguments for each of
the styles in separate brarckets.
Regards,
Dave.