MathGroup Archive 2007

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

Search the Archive

Re: Mathematica 6.0 easier for me ... (small review)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76565] Re: [mg76457] Mathematica 6.0 easier for me ... (small review)
  • From: Brett Champion <brettc at wolfram.com>
  • Date: Thu, 24 May 2007 05:58:34 -0400 (EDT)
  • References: <200705230859.EAA23180@smc.vnet.net>

On May 23, 2007, at 3:59 AM , Paul at desinc.com wrote:

>
> 6.  Very few gotchas.  I have only found one, though it keeps biting
> me.  If I have two lists, one from 0-100 in both axis and the other
> from 0-1000 in both axis, Show[] will truncate!
>
> lisA = Table[i^2, {i, 0, 1000}];
> lisB = Table[i, {i, 0, 100}];
> p1 = ListPlot[lisA, Joined -> True];
> p2 = ListPlot[lisB, Joined -> True];
> Show[p1, p2]
> Show[p2, p1]
>
> The first plot parameter to Show[] determines truncation.  5.2 did not
> do this!!  Of course, change Joined to PlotJoined for 5.2.  A small
> gotcha, but never the less a gotcha that burned me once already.  My
> fault.  New is not worse, just different.  To me, Show[] simply
> Showed.  Now it is not.  PlotRange->All fixes this.  I wish there was
> a way to default to All for Show[].

In previous versions of Mathematica, ListPlot left PlotRange- 
 >Automatic as PlotRange->Automatic in the generated Graphics[]  
objects.  When multiple such things were combined with Show, the  
combined graphic still had PlotRange->Automatic, and everything was  
fine.

In Mathematica 6.0, ListPlot and other visualization functions  
resolve PlotRange->Automatic into explicit ranges like {{0,1000}, 
{0,10^6}} for a variety of reasons.  For example, if we leave it at  
PlotRange->Automatic, it's possible to find examples where adding  
Filling->Bottom would be wrong because the points added at the bottom  
of the polygon are enough to cause a different plot range to be  
calculated.  When multiple such things are combined with Show, the  
options from the first graphic are used, and so you potentially get a  
PlotRange that isn't very useful.

In your particular example you could of course just use

	ListPlot[{lisA, lisB}, Joined->True]

or the equivalent

	ListLinePlot[{lisA, lisB}]

or use something like

	Show[{p1, p2}, PlotRange->Automatic]

in cases where you can't just use a single List(Line)Plot command.

Brett Champion
Wolfram Research


  • Prev by Date: Re: Re: Using Locators in Mathematica v6
  • Next by Date: On typesetting
  • Previous by thread: Re: Mathematica 6.0 easier for me ... (small review)
  • Next by thread: Re: Re: Mathematica 6.0 easier for me ... (small review)