Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: DateListPlot & Locator

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103686] Re: [mg103666] DateListPlot & Locator
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Fri, 2 Oct 2009 08:24:57 -0400 (EDT)
  • Reply-to: jfultz at wolfram.com

The graphical coordinates used to represent the x axis in your plot have
to be a single number, not the list of numbers you show here.  But
fortunately this works out very well because the number DateListPlot
is using is the absolute time which corresponds to the dates/times.
So all you need to do is add code to use AbsoluteTime[] and DateList[]
to convert the values back and forth. E.g.,

dl = {DatePlus[#], RandomInteger[{1, 40}]} & /@ (Range[12]*-1)
Manipulate[DateListPlot[dl, Joined -> True], 
 Dynamic[{DateList[p1[[1]]], 
   p1[[2]]}], {{p1, {AbsoluteTime[dl[[4, 1]]], dl[[4, 2]]}}, Locator}]

Sincerely,
 
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.

On Thu, 1 Oct 2009 07:33:29 -0400 (EDT), Ulrich Arndt wrote:
> Hi all,
>
> I am working with mathematica 7 - just started...
> Is it possible to use Locator with DateListPlot?
>
> dl = {DatePlus[#], RandomInteger[{1, 40}]} & /@ (Range[12] * -1)
> Manipulate[
> DateListPlot[dl, Joined -> True],
> Dynamic[p1],
> {{p1, dl[[4]]}, Locator}]
>
> is at least not doing what I expected.
> The varibale p1 is set correctly but not placed correctly and if you
> move the locator p1[[1]] is changed from a date to a real...
>
> Kind regards Ulrich





  • Prev by Date: Re: Making raw HTML appear in a notebook exported to HTML
  • Next by Date: Re: Re: Incorrect symbolic improper integral
  • Previous by thread: Re: DateListPlot & Locator
  • Next by thread: Re: How to ±