Menu

#2010 steps, fsteps and histeps with gapped time series show weird behaviour

None
closed-invalid
nobody
None
2018-08-24
2018-01-11
Anonymous
No

Hi
I was running the following code on different gnuplot versions (5.0 & 5.2), including the latest git snapshot

set xdata time
set timefmt "%Y-%m-%d"
plot [*:"2017-11-31"][-2:100] "dates_test2.txt" using 3:2 with imp   lw 2 t "contributions" ,\
                              "dates_test2.txt" using 3:1 with steps lw 2 t "cumulative sum"

The data file is attached and contains a gapped time series, i.e., entries are not equally spaced in the date x-axis. In this way steps, fsteps and histeps fail to properly plot the cumulative sum. In the plot it shows up as missing steps such that the cumulative sum does not match the timeseries. These with qualifiers work as expected if I plot instead a list of consecutive entries:

set xdata time
set timefmt "%Y-%m-%d"
plot [*:"2017-11-31"][-2:100] "dates_test2.txt" using 2 with imp   lw 2 t "contributions" ,\
                              "dates_test2.txt" using 1 with steps lw 2 t "cumulative sum"

I hope this behaviour is not a feature...

best
Patrick

1 Attachments

Discussion

  • Ethan Merritt

    Ethan Merritt - 2018-01-11

    1) The plot commands you show are not accepted by either version 5.0 or 5.2
    Could you please upload a corrected version so that we can see what the actual commands are?

    2) I don't understand where "cumulative sum" enters into this. The only gnuplot plot style I can think of that might be described that way is stacked histograms. If you really do want a cumulative function, the running average demo might serve as a model
    http://gnuplot.sourceforge.net/demo_cvs/running_avg.html

     
  • Daniel Boles

    Daniel Boles - 2018-01-28

    It runs for me, on 5.2 patchlevel 2 (after adding a terminal/output, obviously)

    but I don't know what I'm looking at. How does a "cumulative sum" make sense when the rows aren't sorted by date? Are you going back in time and adding contributions? :-)

    result attached

     
  • Ethan Merritt

    Ethan Merritt - 2018-08-24
    • status: open --> closed-invalid
    • Group: -->
    • Priority: -->
     

Log in to post a comment.