MathGroup Archive 2008

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

Search the Archive

Re: Vary PlotStyle in ListPlot ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90071] Re: Vary PlotStyle in ListPlot ?
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Fri, 27 Jun 2008 06:21:34 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <g3vkp3$kca$1@smc.vnet.net>

Coleman, Mark wrote:

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

Mark,

one can pass a list of directives to PlotStyle and a list of lists for 
the points to be plotted, each list taking into account the 
corresponding graphic directives. For instance,


data = Table[{k, Sin[k] + RandomReal[{-1, 1}]}, {k, 0, 2 Pi,
     2 Pi/1000}];

myRegion1 = Cases[data, {x_ /; 1 < x < 3, y_ /; 1/2 < y < 3/2}];

myRegion2 = Cases[data, {x_, y_ /; y < -1}];

pts = { Complement[data, myRegion1, myRegion2], myRegion1,
    myRegion2};

ListPlot[pts,
  PlotStyle -> {Directive[Red, PointSize[Medium]],
    Directive[Darker[Green], PointSize[Large]],
    Directive[Orange, PointSize[Small]]}]

Regards,
-- Jean-Marc


  • Prev by Date: Re: documentation specification for Documentation Center
  • Next by Date: Re: Re: does not work properly
  • Previous by thread: Re: Vary PlotStyle in ListPlot ?
  • Next by thread: Re: Vary PlotStyle in ListPlot ?