MathGroup Archive 2008

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

Search the Archive

ListPlot & lots 'o dots.

  • To: mathgroup at
  • Subject: [mg87735] ListPlot & lots 'o dots.
  • From: Annetts729 <David.Annetts at>
  • Date: Wed, 16 Apr 2008 05:05:16 -0400 (EDT)


Apparently ListPlot has a quirk on my systems (XP SP2/3, 6.0.2)

With test data

  test = Table[N@Sin[n \[Pi] x], {n, 1, 5, 1}, {x, -\[Pi], \[Pi], \

ListPlot[test] produces a plot with lots 'o dots as expected.  It's
easy to see which dots correspond to which frequency by connecting
points in each data set

  ListPlot[test, Joined->True]

We can correct the ordinate scale using

  ListPlot[test, Joined->True, DataRange->{-\[Pi], \[Pi]}], and for
lots 'o plots this looks messy.

Using SetOptions, we can set ListPlot up so that we don't need to
specify Joined & a data range every time we use ListPlot using

  SetOptions[ListPlot, DataRange -> {-\[Pi], \[Pi]}, Joined ->
True ];

We can confirm ListPlot's new settings either by removing the ";" or
using Options@ListPlot.

For me this is where the problem starts.

After an appropriate SetOptions (like above), ListPlot[test] should
give me a plots that is joined & has the correct ordinate scale.  For
me it doesn't, despite Joined->True and DataRange, ListPlot[test] gets
ma a plot with lots 'o dots and the wrong scale.  I know there's a
point to SetOptions since I can set (eg) a PlotRange and FrameLabels.
It's just that ListPlot (apparently) ignores DataRange & Joined so
that I have to specify them each time I use ListPlot.

I'd like to know if this problem restricted to my system.  In the
event that it can be reproduced, I'll report it as a bug.

test = Table[N@Sin[n \[Pi] x], {n, 1, 5, 1}, {x, -\[Pi], \[Pi], \[Pi]/
50}]; (* generate test data *)
ListPlot[test] (* plot w/ lots o dots *)
ListPlot[test, Joined -> True, DataRange -> {-\[Pi], \[Pi]}] (*
desired plot *)
SetOptions[ListPlot, DataRange -> {-\[Pi], \[Pi]}, Joined -> True,
FrameLabel -> {"Hi", "Lo"}, PlotRange -> {0,  [Pi]/2}]; (* set default
options for ListPlot *)
ListPlot[test] (* dotty plot, incorrect ordinate but correct abscissa
& labels -- WTF? *)



  • Prev by Date: Re: Solving equations and inequalities with Reduce - how?
  • Next by Date: Re: Solving equations and inequalities with Reduce - how?
  • Previous by thread: Re: Select from list
  • Next by thread: Re: ListPlot & lots 'o dots.