Loading ...
Sorry, an error occurred while loading the content.
 

Missing datetime arithmetic?

Expand Messages
  • Lukas Zimmermann
    I d like to produce a plot presenting data from last hour. It may happen that the one hour range crosses the day boundary. So I have to use datetime as the
    Message 1 of 2 , Jan 13, 2003
      I'd like to produce a plot presenting data from last hour. It may happen that
      the one hour range crosses the day boundary. So I have to use datetime as the
      x-axis type. As I don't want any stub text surpassing the width of the plot
      itself, I want to limit the stubrange to the time of the last data point
      minus 20 minutes with a stub increment of 30 minutes.
      I tried this with the script below, which doesn't work.
      Does anybody have an idea, how I may reach my goal?

      Thanks and regards,
      Lukas Zimmermann

      #proc getdata
      data: 2003-01-13.23:30:03 -22.3
      2003-01-13.23:35:06 -18.2
      2003-01-13.23:40:04 17.6
      2003-01-13.23:46:04 30.8
      2003-01-13.23:49:55 -50.2
      2003-01-13.23:55:06 -18.2
      2003-01-14.00:04:04 17.6
      2003-01-14.00:16:04 30.8
      2003-01-14.00:20:55 -50.2
      2003-01-14.00:24:55 -20.8
      2003-01-14.00:30:05 10.7

      #proc areadef
      rectangle: 0 0.2 1.3 0.7
      yrange: -100 100
      xscaletype: datetime yyyy-mm-dd.hh:mm:ss
      xautorange: datafield=1
      frame: no

      #proc yaxis
      stubs: none
      tics: none
      axisline: width=0.5 style=0

      #proc xaxis
      // inc 30 minutes doesn't seem to work
      stubs: inc 30 minutes
      stubslide: 0.13
      stubdetails: size=6
      axisline: width=0.5 style=0
      stubformat: hh:mm
      // limit the range for stubs to 20 minutes before last data point
      #set TF = $tomin(@XFINAL)
      #set TF = $arith(@TF-20)
      #set TF = $frommin(@TF)
      stubrange: @XSTART @TF

      #proc lineplot
      xfield: 1
      yfield: 2
    • Stephen C. Grubb
      Lukas, Since horizontal space seems to be a consideration, you might consider using vertical stubs. Note that, with datetime scaling, the basic underlying unit
      Message 2 of 2 , Feb 12, 2003
        Lukas,

        Since horizontal space seems to be a consideration, you might consider
        using vertical stubs.

        Note that, with datetime scaling, the basic underlying unit is 1 day.
        Perhaps some of the problems with your computations were caused by this.

        Your example has shown some bugs with datetime scaling and axis
        generation. If you use
        stubs: inc

        ..you get reasonable stubs, but with a strange increment (7 minutes?),
        probably an artifact of the fact that 1 day is the basic unit.

        I have tried to fix these problems in proc_axis.c ... now datetime stubs
        can be rendered in hours or minutes. If you like I can email the new
        proc_axis.c to you.

        -Steve



        On Tue, 14 Jan 2003, Lukas Zimmermann wrote:

        > I'd like to produce a plot presenting data from last hour. It may happen that
        > the one hour range crosses the day boundary. So I have to use datetime as the
        > x-axis type. As I don't want any stub text surpassing the width of the plot
        > itself, I want to limit the stubrange to the time of the last data point
        > minus 20 minutes with a stub increment of 30 minutes.
        > I tried this with the script below, which doesn't work.
        > Does anybody have an idea, how I may reach my goal?
        >
        > Thanks and regards,
        > Lukas Zimmermann
        >
        > #proc getdata
        > data: 2003-01-13.23:30:03 -22.3
        > 2003-01-13.23:35:06 -18.2
        > 2003-01-13.23:40:04 17.6
        > 2003-01-13.23:46:04 30.8
        > 2003-01-13.23:49:55 -50.2
        > 2003-01-13.23:55:06 -18.2
        > 2003-01-14.00:04:04 17.6
        > 2003-01-14.00:16:04 30.8
        > 2003-01-14.00:20:55 -50.2
        > 2003-01-14.00:24:55 -20.8
        > 2003-01-14.00:30:05 10.7
        >
        > #proc areadef
        > rectangle: 0 0.2 1.3 0.7
        > yrange: -100 100
        > xscaletype: datetime yyyy-mm-dd.hh:mm:ss
        > xautorange: datafield=1
        > frame: no
        >
        > #proc yaxis
        > stubs: none
        > tics: none
        > axisline: width=0.5 style=0
        >
        > #proc xaxis
        > // inc 30 minutes doesn't seem to work
        > stubs: inc 30 minutes
        > stubslide: 0.13
        > stubdetails: size=6
        > axisline: width=0.5 style=0
        > stubformat: hh:mm
        > // limit the range for stubs to 20 minutes before last data point
        > #set TF = $tomin(@XFINAL)
        > #set TF = $arith(@TF-20)
        > #set TF = $frommin(@TF)
        > stubrange: @XSTART @TF
        >
        > #proc lineplot
        > xfield: 1
        > yfield: 2
        >
        >
        >
        >
        > To unsubscribe from this group, send an email to:
        > ploticus-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        >
        >
        >


        Stephen C. Grubb scg@...
        Scientific Software Engineer, The Jackson Laboratory
        600 Main Street Bar Harbor, Maine 04609 USA
      Your message has been successfully submitted and would be delivered to recipients shortly.