Menu

#1404 column(1) not equivalent to $1 for time data

closed-invalid
nobody
None
5
2015-03-23
2014-05-16
No

According to the documentation, $1 is only a shortcut for column(1). But for time data, using column(1) works correctly, but $1 doesn't:

$data <<EOD
2014-04-06 1
2014-04-07 2
2014-04-08 0
EOD

set timefmt '%Y-%m-%d'
set xdata time

set style data lines

set multiplot layout 3,1
plot $data using 1:2
plot $data using ($1):2
plot $data using (column(1)):2
unset multiplot
1 Attachments

Discussion

  • Ethan Merritt

    Ethan Merritt - 2014-05-16

    You are being misled by the special case that your time format contains no whitespace. In fact neither column(1) nor $1 can be used to read time data in general. That is why there is a separate function timecolumn(1,"format").

    To better understand what is happening, try this variant:

    $data <<EOD
    2014 04 06 1
    2014 04 07 2
    2014 04 08 0
    EOD
    
    set timefmt '%Y %m %d'
    set xdata time
    
    set style data lines
    
    set multiplot layout 4,1
    plot $data using 1:4
    plot $data using (timecolumn(1, "%Y %m %d")):4
    plot $data using ($1):4
    plot $data using (column(1)):4
    unset multiplot
    
     
  • Christoph Bersch

    Ok, I see, thanks. I was trying to understand the consequences of changing the signature of timecolumn to require two arguments.
    It means, that any kind of operation with time data inside using can only be done by giving explicitely the time format.

    Thanks

     
  • Christoph Bersch

    • status: open --> closed-invalid
     

Log in to post a comment.

MongoDB Logo MongoDB