Re: I'm puzzled by drastic truncation of y-axis in DateListLogPlot

• To: mathgroup at smc.vnet.net
• Subject: [mg115348] Re: I'm puzzled by drastic truncation of y-axis in DateListLogPlot
• From: Darren Glosemeyer <darreng at wolfram.com>
• Date: Sat, 8 Jan 2011 03:39:44 -0500 (EST)

```On 1/7/2011 3:13 AM, James Stein wrote:
> I ran into some curious behavior I can't explain. I have two rather benign
> lists of numbers, of equal length. When either is plotted alone, all goes as
> expected; and when they are plotted together, all goes *almost* as
> expected.  Dropping the last two or more values makes the plotting normal,
> but dropping only one, or none, the y axis extends up only to 5 (instead of
> to 20); and the dropped values are not near the extreme values.
>
> If you copy the below into a cell and evaluate it, the gist of what I've
> said above will, I hope, be clear. Have I done something stupid?
>
> (* d is a list of dates; a and b are data; we combine 'd'
> with a and b to form two lists for DateListLogPlot: *)
> d={{2007,8,31},{2007,9,28},{2007,10,31},{2007,11,30},{2007,12,31},{2008,1,31},{2008,2,29},{2008,3,31},{2008,4,30},{2008,5,30},{2008,6,30},{2008,7,31},{2008,8,29},{2008,9,30},{2008,10,31},{2008,11,28},{2008,12,31},{2009,1,30},{2009,2,27},{2009,3,31},{2009,4,30},{2009,5,29},{2009,6,30},{2009,7,31},{2009,8,31},{2009,9,30},{2009,10,30},{2009,11,30},{2009,12,31},{2010,1,29},{2010,2,26},{2010,3,31},{2010,4,30},{2010,5,28},{2010,6,30},{2010,7,30},{2010,8,31},{2010,9,30},{2010,10,29},{2010,11,30},{2010,12,31},{2011,1,4}};
> a={20.78,21.3,18.5,16.11,13.58,10.04,6.74,5.88,7.63,9.32,8.83,7.84,8.04,5.07,2.41,1.94,1.48,1.64,1.82,2.04,2.4,2.88,2.46,2.05,1.74,2.1,1.48,1.81,1.97,1.67,1.79,2.13,2.35,2.52,2.12,2.34,2.23,2.6,2.5,2.38,2.6,2.64};
> b={1.43,1.45,1.48,1.50,1.52,1.55,1.57,1.59,1.62,1.64,1.67,1.696,1.712,1.75,1.77,1.80,1.83,1.86,1.88,1.91,1.94,1.97,2.00,2.03,2.1,2.10,2.13,2.16,2.20,2.23,2.26,2.30,2.33,2.36,2.40,2.44,2.48,2.52,2.55,2.59,2.63,2.64};
> a=Transpose[{d,a}];
> b=Transpose[{d,b}];
> c={a,b};
>
> (* a and b can be plotted alone; but when plotted together
> we get drastic truncation at the top of the log axis: *)
> DateListLogPlot[a,Joined->True,PlotLabel->"a alone"]
> DateListLogPlot[b,Joined->True,PlotLabel->"b alone"]
> DateListLogPlot[c,Joined->True,PlotLabel->"a and b"]
>
> (* the drastic truncation occurs suddenly; if at least two rightmost values
> are truncated, all is OK: *)
> x=Length[d];
> Table[DateListLogPlot[{Take[a,n],Take[b,n]},Joined->True,PlotLabel->ToString[n],ImageSize->Small],{n,x-3,x}]
>

The plotting functions use heuristics to determine the range of y values
to plot. The heuristics combine a number of factors and in some cases it
may be preferable to explicitly set the PlotRange to avoid clipping
parts of the plot. For instance, in this example

DateListLogPlot[c, Joined -> True, PlotLabel -> "a and b",
PlotRange -> Through[{Min, Max}[c[[All, All, 2]]]]]

can be used to avoid clipping due to the automatic heuristic.

Darren Glosemeyer
Wolfram Research

```

• Prev by Date: Re: Extracting pixel values from an image under a polygon (region of interest)
• Next by Date: Re: Using Extract where some indices are out of bounds (efficiently)
• Previous by thread: I'm puzzled by drastic truncation of y-axis in DateListLogPlot
• Next by thread: Re: I'm puzzled by drastic truncation of y-axis in DateListLogPlot