MathGroup Archive 2008

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

Search the Archive

RE: Vary PlotStyle in ListPlot ?


Hi Mark,

> 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.

This should be a matter of setting up different styles and partitioning your
data accordingly (eg Cluster[] or Cases[])

Something like 

pstyl = {
   {Directive[Opacity[.25], PointSize[.01]], Black},
   {Directive[Opacity[.5], PointSize[.05]], Red},
   {Directive[Opacity[.25], PointSize[.01]], Green}};

split[lst_?VectorQ] := {Select[lst, # < 4 &], 
   Select[lst, 4 <= # 7.5 &], Select[lst, # >= 7.5 &]};

data = RandomReal[{0, 10}, 100];
ListPlot[split@data, PlotStyle -> pstyl]

should get you some ideas.

Regards,

Dave.



  • Prev by Date: Re: How to get the size of Inset in Graphics?
  • Next by Date: Re: Package File for Different Mathematica Versions
  • Previous by thread: Vary PlotStyle in ListPlot ?
  • Next by thread: Re: Vary PlotStyle in ListPlot ?