Search code examples
gnuplot

Plotting format 1d 10:05 in gnuplot


How i able to plot this in gnuplot the following times in gnuplot?

But the graph does not seem to adapt the hours after the days.

set timefmt "%jd %H:%M"

in my test.csv there is:

0,1d 10:15
1,1d 10:05
2,1d 1:50
3,2d 3:30

plot "test.csv" enter image description here

As seen in the picture the time is not plotted correctly.


Solution

  • You have to tell gnuplot that your data separator is comma. Per default it is whitespace. In the example below skip the $Data datablock and in the plot command replace $Data by Test.csv. There, column2 is plotted versus column1. Maybe you want it the other way round, it's not clear from your question, graph and plot command.

    Code:

    ### plotting time data
    reset session
    
    $Data <<EOD
    0,1d 10:15
    1,1d 10:05
    2,1d 1:50
    3,2d 3:30
    EOD
    
    set datafile separator comma
    myTimeFmt = "%jd %H:%M"
    set format y myTimeFmt time
    
    plot $Data u 1:(timecolumn(2,myTimeFmt)) w lp pt 7 notitle
    ### end of code
    

    Result:

    enter image description here