Menu

#1202 String variables don't work with various timefmt operations

closed-fixed
nobody
None
5
2015-03-23
2013-01-25
No

If this isn't a bug, maybe you could consider it a feature request:

gnuplot> TIMEFMT = '%Y-%m-%d'
gnuplot> set timefmt TIMEFMT
^
time format string expected

One hacky workaround is:

eval('set timefmt "%s"',TIMEFMT)

but I hope we can agree that isn't ideal. Another thing which doesn't work is setting the xrange with a string function.

set xrange ["2012-01-13":] #works OK
set xrange [strftime(TIMEFMT,strptime(TIMEFMT,"2012-01-13")) : ] #produces funny results.

Again, we can work around this with `eval`, but it seems less than ideal.

For a full script which you can play around with and use case, see the following:

http://stackoverflow.com/questions/14508846/gnuplot-setting-yrange-days-back

fun info: OSX 10.5.8, gnuplot 4.4 and gnuplot 4.6 (I'll test with 4.6 and 4.7 when I'm able).

Discussion

  • Ethan Merritt

    Ethan Merritt - 2013-01-25

    It's pure oversight. Everything was supposed to have been converted to accept string variables, but somehow that command and the "bind" command were missed. I'll make sure it's fixed for 4.6.2 (unless there's some subtle thing I'm missing that makes this one harder than all other commands).

     
  • Ethan Merritt

    Ethan Merritt - 2013-01-25
    • status: open --> pending-fixed
     
  • Ethan Merritt

    Ethan Merritt - 2013-02-20
    • status: pending-fixed --> closed-fixed
    • milestone: --> 5.0
     

Log in to post a comment.