RE: Vary PlotStyle in ListPlot ?
- To: mathgroup at smc.vnet.net
- Subject: [mg90029] RE: [mg90005] Vary PlotStyle in ListPlot ?
- From: "David Annetts" <davidannetts at aapt.net.au>
- Date: Fri, 27 Jun 2008 06:12:41 -0400 (EDT)
- References: <200806260842.EAA20890@smc.vnet.net>
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.
- References:
- Vary PlotStyle in ListPlot ?
- From: "Coleman, Mark" <Mark.Coleman@LibertyMutual.com>
- Vary PlotStyle in ListPlot ?