dkogan/feedgnuplot

Plotting both regular and cumulative histogram (from the same data) on the same graph

Closed this issue · 5 comments

aktau commented

This is often done in papers and I'd like to do the same. Is it possible with feedgnuplot or do I have to go for manual gnuplot scripts? Reading the man page makes me think it cannot be done currently. I could think of a hack to pass the dataset twice, but the histstyle argument does not allow choosing a specific curve to render AFAIK. Thanks.

aktau commented

No problem at all, I'm sure this is pretty fringe. If adding this feature is just difficult from the point-of-view of constructing a command-line, I'd be happy not having it either. What I'm planning to do is to see what feedgnuplot(1) produces for both types of histograms, and manually create a gnuplot script that contains both. Then I just:

  { 
    echo "gnuplot script
               plot '-' ..." 
    data-generating-script
    echo "e"
  } | gnuplot

Which is a bit ugly, but works :). Thanks for considering it!

Hi. I just looked at this, and unfortunately, it's fairly painful to make this work without breaking the existing api. You can hack it with something like this:

seq 500 | awk '{print $1*$1,$1*$1}' | feedgnuplot --style 1 'using (histbin2($2)):(1.0) smooth cnormal  with lines' --binwidth 10000 --extracmds 'histbin2(x) = 100 * floor(0.5 + x/100)' --y2 1 --histo 0

So you duplicate the data, define another histbin function (with a higher resolution), and explicitly set the style. AND you need to modify the sources to not print "notitle". And even then, the histogram bars end up being plotted on top of the cumulative line.

I'm sorry, but I can't do this in a reasonable way. If I hear multiple other users request this feature, maybe I'll think about it again, but I just can't figure out how to do this right now.

aktau commented

Hi Dima,

No worries, as someone who's designed CLIs before (admittedly less full-featured than feedgnuplot), I can feel the pain of trying to cater to all use cases. Sometimes it's best to say no.

However, I'm very glad for the alternate suggestion, that would've taken me a lot of time to come up with myself.