MathGroup Archive 2011

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

Search the Archive

Problem with DateListPlot Aspect Ratio

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117581] Problem with DateListPlot Aspect Ratio
  • From: "Miranda, Juan" <juan.miranda at hp.com>
  • Date: Wed, 23 Mar 2011 02:55:31 -0500 (EST)

Hi everyone,

I have had some troubles with DateListPlot, my version of Mathematica is 8.0.1, so this is my problem.

I'm creating a random time indexed list with 300 data, in order to plot the data I'm using the DateListPlot function, I want to have the PlotRange varying with an slider in order to see a larger or smaller range of data. So I wrote the next problem to exemplify what is happening, I have an Slider that changes the percentage of time I want to see from 0 to 1, there are two DateListPlots, both of them plot the same 300 data points, and have the ImageSize defined as {800,200}, the first one as the AspectRatio defined as GoldenRatio, the second one has the AspectRatio defined as Full because I want the graphic to cover the whole imagesize space. So when percentage has the value of 1 (To show 100% the time range), both graphics work as expected.  But if I move the Slider in order to select a value of percentage behind 0.7 (approx. 70%), the first graph that is not the one that I want to implement works just fine, but the second one that is the one I want to implement just show som
 e!
 weird lines. I'm starting thinking that it is a bug. Can someone tell me how to correct this bug? I want to conserve the Time related ticks in the DateListPlot.

Needs["Calendar`"]
pointsnum = 300;
percentage = 1;
data = Transpose[{Map[(DatePlus[{2011, 1, 1}, #]) &,
     Range[pointsnum]], RandomReal[100, pointsnum]}];
Grid[{{Grid[{{Slider[Dynamic[percentage]], Dynamic[percentage]}}]}, {
   Dynamic[
    DateListPlot[data, Joined -> True, ImageSize -> {800, 200},
     AspectRatio -> GoldenRatio,
     PlotRange -> {{data[[1, 1]],
        DatePlus[data[[1, 1]], (pointsnum - 1)*percentage]}, {0,
        100}}]]
   }, {
   Dynamic[
    DateListPlot[data, Joined -> True, ImageSize -> {800, 200},
     AspectRatio -> Full,
     PlotRange -> {{data[[1, 1]],
        DatePlus[data[[1, 1]], (pointsnum - 1)*percentage]}, {0,
        100}}]]
   }}]


Best.

Juan


  • Prev by Date: Re: "set" data structure in Mathematica? (speeding up
  • Next by Date: Re: "set" data structure in Mathematica? (speeding up
  • Previous by thread: Re: "set" data structure in Mathematica? (speeding up
  • Next by thread: Re: Problem with DateListPlot Aspect Ratio