MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Vary PlotStyle in ListPlot ?


Coleman, Mark wrote:
> Greetings,
> 
> I'm producing ListPlots with a  large number (>100000) pairs of points.
> Is there a way to vary the PlotStyle in a single ListPlot command, so
> that sets of points in a certain region are a different color or Opacity
> than points outside the region? This is simple using Show and individual
> ListPlots, but I'm wondering if it can be done within a single ListPlot
> command.
> 

I do not know of any way to colour points by region with a single 
ListPlot (ColourFunction only works with Joined -> True).  Just use 
Select to sort points into sets, and then you can use a single ListPlot 
to plot the sets with different colours.

points = RandomReal[{-1, 1}, {200, 2}];

inner = Select[points, Norm[#] < 1 &];
outer = Select[points, Norm[#] >= 1 &];

ListPlot[{inner, outer}, AspectRatio -> Automatic,
  PlotStyle -> {Red, Blue}]


  • Prev by Date: Re: Happy Birthday Mathematica!
  • Next by Date: help about calling external programs through a Button
  • Previous by thread: Re: Vary PlotStyle in ListPlot ?
  • Next by thread: 0.0 is different with 0?