Re: Use color with ListPlot?
- To: mathgroup at smc.vnet.net
- Subject: [mg67919] Re: Use color with ListPlot?
- From: albert <awnl at arcor.de>
- Date: Thu, 13 Jul 2006 06:53:07 -0400 (EDT)
- References: <e92ehc$lt7$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Xiangdong Liu wrote:
> Hi again,
>
> 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]}}];
It should be RGBColor, not RGColorB, but I suspect this is not your problem.
Your lists are having the wrong structure to show two different colors, the
following shows the two curves with different colors:
Plot[{Sin[x], Cos[x]}, {x, 0, 4Pi},
PlotStyle->{RGBColor[0,0,1], RGBColor[0,1,0]}];
if you want to specify further details this also works:
Plot[{Sin[x], Cos[x]}, {x, 0, 4Pi},
PlotStyle->{{RGBColor[0,0,1]},{RGBColor[0,1,0]}}];
> (well, except that I don't see two colors (B and G) but only one (G)).
>
> 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]}}];
use only a list of depth 1 for the option PlotStyle in ListPlot, the
following works for me:
ListPlot[{{1,2}, {4, 2}, {1,4}, {4, 2}}, PlotJoined->True,
PlotStyle->{RGBColor[0,0,1]}];
if you want to plot serveral curves you will need MultipleListPlot from
Graphics`MultipleListPlot`, which of course also supports to give different
styles to the different curves...
hth,
albert