MathGroup Archive 2008

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

Search the Archive

Re: Problems with ListPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89047] Re: Problems with ListPlot
  • From: igorvict at gmail.com
  • Date: Sat, 24 May 2008 03:56:15 -0400 (EDT)
  • References: <g11r71$adu$1@smc.vnet.net>

On May 21, 10:55 pm, Bill Rowe <readn... at sbcglobal.net> wrote:
> On 5/20/08 at 6:53 AM, szhor... at gmail.com (Szabolcs Horv=C3=A1t) wrote=
:
>
> >igorv... at gmail.com wrote:
> >>I noticed the following problems when creating ListPlot in
> >>Mathematica 6 (see the example):
> >>ListPlot[{0, 1, 2}, PlotMarkers -> Style["\[FilledCircle]",
> >>FontSize -> 12], Joined -> True, GridLines -> Automatic, PlotRange
> >>-> {{1, 3}, {0.5, 1.5}}, PlotRangeClipping -> False, ImagePadding
> >>-> 10]
> >>1) The plot markers have an offset slightly to the left from their
> >>correct position
> >Precise positioning is not really achievable when glyphs from a font
> >are used as plot markers.  The problem can be cured by using
> >graphics objects:
> >PlotMarkers -> {Graphics[Circle[]], .05}
> >Or if you need disks as plot markers, then just use a larger point
> >size.
>
> Why not use
>
> PlotMarkers -> {Graphics[Disk[]], .05}
>
> if you want disks as plot markers instead of circles?
>
> >>2) In addition of 1 point and 1 line (2 other should be clipped as
> >>they lie outside of the range) I see 2 points, where the line
> >>crosses the lower and upper edges of the plot.
> >I don't really understand this second question ...
>
> I think the original poster was thinking the graphic should be
> consistent with:
>
> ListPlot[{0, 1, 2}, PlotMarkers -> {Graphics[Disk[]], .05},
>   Joined -> True, GridLines -> Automatic,
>   PlotRange -> {{1, 3}, {0.5, 1.5}}]
>
> Notice the top and bottom disks are clipped since the specified
> value of PlotRange isn't sufficient to fully include the top and
> bottom disks.
>
> I believe the reason this was not seen using the original
> poster's code was due to the inclusion of the ImagePadding
> option and using PlotRangeClipping->False which combine so that
> the top and bottom disks are not clipped. That is compare the
> graphic using the code above to:
>
> ListPlot[{0, 1, 2}, PlotMarkers -> {Graphics[Disk[]], .05},
>   Joined -> True, GridLines -> Automatic,
>   PlotRange -> {{1, 3}, {0.5, 1.5}}, PlotRangeClipping -> False,
>   ImagePadding -> 10]

Actually, the problem with using Disk[] (or Point[]) is that they are
much slower than the default.

Try to run:

ListPlot[Range[1000], PlotMarkers -> {Graphics[Disk[]], 0.02}]

Compare it with:

ListPlot[Range[1000]]

And if you try to use Range[10000], you will see another difference.
Of course, that's a very large number of points, I don't need this in
practice, but I need to optimize the speed.
Actually, I need to plot several functions on the same plot, some of
which with points shown, some of them only as joined lines.

I think, that I need to use Show to implement this correctly.
Didn't yet try to measure speed of this function..


  • Prev by Date: Re: "Reduce" wierdness (or too slow?)
  • Next by Date: Re: "Reduce" wierdness (or too slow?)
  • Previous by thread: Re: Problems with ListPlot
  • Next by thread: Re: Problems with ListPlot