MathGroup Archive 2004

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

Search the Archive

RE: User-defined or filled symbols for Points in ListPlots and Epilogs?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49335] RE: [mg49329] User-defined or filled symbols for Points in ListPlots and Epilogs?
  • From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
  • Date: Thu, 15 Jul 2004 06:59:57 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

>-----Original Message-----
>From: AES/newspost [mailto:siegman at stanford.edu]
To: mathgroup at smc.vnet.net
>Sent: Wednesday, July 14, 2004 1:30 PM
>To: mathgroup at smc.vnet.net
>Subject: [mg49335] [mg49329] User-defined or filled symbols for Points in
>ListPlots and Epilogs?
>
>
>Are there any simple or easy ways to substitute a user-defined symbol, 
>especially a "filled" symbol, for the Points in a ListPlot or Epilog?
>
>The data I want to plot is already created in lengthy lists of the form
>
>     pointData  =  { {x1,y1}, {x2,y2}, . . . . . }
>
>which I can plot directly by using ListPlot or by putting 
>Map[Point, pointData]  into an Epilog.  I suppose I could 
>create filled 
>circles to replace the Points in this Epilog, for example, by using 
>something like
>
>     Epilog->{White, Map[Disk, convertedPointData], 
>                                       Map[Circle, convertedPointData]}
>
>so that the filled opaque circles would overlay and hide the 
>theoretical 
>data lines that pass underneath them.  Trying to convert my  
>pointData  
>lists into the necessary form so that I can do this has proven to be a 
>frustrating exercise, however.
>
>So, is there a way to do this list conversion so that Disk and Circle 
>will Map onto the resulting list? -- or, a way to redefine the point 
>symbol in Point to be something more complex?  
>
>(Having gotten used to the joys of Stroke and Fill in Illustrator, I'm 
>frustrated that Mathematica doesn't seem to offer -- or I haven't been 
>able to find -- similar graphical constructs.)
>
>

Dear Professor Siegman,

the right package do do this is

<< Graphics`MultipleListPlot`

as explained at Help.  Just to make that example there a bit more illustrative, try

(list1 = Table[{x, Sin[2 Pi x]}, {x, 0, 1, 0.1}];
    list2 = Table[{x, Cos[2 Pi x]}, {x, 0, 1, 0.1}]);

MultipleListPlot[list1, list2, PlotJoined -> True, 
  PlotStyle -> {GrayLevel[0], Dashing[{Dot, Dash}]}, 
  SymbolShape -> {PlotSymbol[Triangle, 7, Filled -> True], 
      PlotSymbol[Box, 4, Filled -> False]}, 
  SymbolStyle -> {Hue[.6], Hue[0.]},
  Background -> GrayLevel[.9]]


After the package is loaded, you may use the symbol generator for your own purposes, e.g. like this:

Plot[Sin[2 Pi x], {x, 0, 1}, 
  Epilog -> {Hue[.6], PlotSymbol[Triangle, 7, Filled -> False] /@ list1}, 
  Background -> GrayLevel[.9]]


If you want to know how that works (and perhaps expand it to other Symbols, other than Triangle, Box, Star, Diamond, and after you've tried MakeSymbol) study that package.  The problem solved in the package is to get the aspect ratio right for the symbols. A hands-on attempt to do that would be (for filled or not filled cirles, which aint in the package) e.g.:

Block[{$DisplayFunction, g}, 
  g = Plot[Sin[2 Pi x], {x, 0, 1}, Background -> GrayLevel[.9]][[1]];
  Show[g, 
    Graphics[With[{ar = FullOptions[g, AspectRatio]}, {Hue[.6], 
          Thickness[.01], Circle[#, Scaled[{.04 ar, .04 }]] & /@ list1}]]]]

(Similar with Disk.) 
You don't need such tricks, however, if you use the Point primitive:

Plot[Sin[2 Pi x], {x, 0, 1}, 
  Epilog -> {Hue[.6], PointSize[.05], Point /@ list1}, 
  Background -> GrayLevel[.9]]


--
Hartmut Wolf


  • Prev by Date: Re: Re: Normal distribtion
  • Next by Date: Normal Product Distribution
  • Previous by thread: Re: User-defined or filled symbols for Points in ListPlots and Epilogs?
  • Next by thread: Re: User-defined or filled symbols for Points in ListPlots and Epilogs?