MathGroup Archive 2007

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

Search the Archive

Re: datelistplot - log axis for values

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82825] Re: [mg82806] datelistplot - log axis for values
  • From: Carl Woll <carlw at wolfram.com>
  • Date: Thu, 1 Nov 2007 05:03:16 -0500 (EST)
  • References: <200710311116.GAA22567@smc.vnet.net>

sdw wrote:

>Hi -
>
>Does anyone have a clever way to make datelistplot act like loglistplot and create nice log Y axis vs. dates?
>
>this is not the same as just logging the y variable before plotting - I want the Y axis to show the actual values on a log scale, not the log values on a linear scale
>
>thanks,
>
>Steven
>
>
>  
>
One way is to use the internal function used by LogPlot and friends. 
First, make Mathematica load the .mx file necessary for LogPlot 
functionality:

In[1]:= LogPlot

Out[1]= LogPlot

Next, let's make some data:

data = CountryData["US", {"GDP", All}];

We need to scale the data:

scaledata = data;
scaledata[[All, -1]] = Log[scaledata[[All, -1]]];

Now, we use the internal function Graphics`LogPlotDump`LogScale (this is 
why we executed In[1], as this function would be undefined if we hadn't):

ticks = Graphics`LogPlotDump`LogScale[Min[scaledata[[All, -1]]], 
Max[scaledata[[All, -1]]]];

Finally, you are ready to make the DateListPlot:

DateListPlot[scaledata,  FrameTicks -> {Automatic, ticks, True, None}]

<plot snipped>

Carl Woll
Wolfram Research


  • Prev by Date: Re: What is the precedence wrt Mathematica infix operators
  • Next by Date: Re: Issue with Locator's crosshairs object
  • Previous by thread: Re: datelistplot - log axis for values
  • Next by thread: Re: Re: datelistplot - log axis for values