You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GnuplotRB loops undefinitely when trying to generate a histogram #10
I got some issues when trying to generate a histogram. I had no problems with points and lines, just with histograms. Below is a minimal example that recreates the behavior - at least on my machine.
Yeah, unfortunately there is a problem in this particular case because of difference in columns which should be used for lines and histogram plots. When you initialize the plot with Daru::DataFrame GnuplotRB is building the query for simplest case that is not enough for histogram. However you can control this by hand and in this case use something like
@dread-uo, here's the error message I got from running your script.
~/.rvm/gems/ruby-2.4.0/gems/gnuplotrb-0.3.4/lib/gnuplotrb/mixins/error_handling.rb:28:in `check_errors': Error in previous command ("line 27: warning: Skipping data file with no valid points"): "gnuplot> plot $DATA1 using 1:2 title "day" , $DATA2 using 1:2 title "mean" , $DATA3 using 1:2 title "sd"; line 27: Too many columns in using specification" (GnuplotRB::GnuplotError)
from ~/.rvm/gems/ruby-2.4.0/gems/gnuplotrb-0.3.4/lib/gnuplotrb/staff/terminal.rb:187:in `close'
from ~/.rvm/gems/ruby-2.4.0/gems/gnuplotrb-0.3.4/lib/gnuplotrb/plot.rb:87:in `plot'
from ~/.rvm/gems/ruby-2.4.0/gems/gnuplotrb-0.3.4/lib/gnuplotrb/mixins/plottable.rb:111:in `to_specific_term'
from ~/.rvm/gems/ruby-2.4.0/gems/gnuplotrb-0.3.4/lib/gnuplotrb/mixins/plottable.rb:53:in `method_missing'
from test.rb:16:in `<main>'
This is what's getting sent to gnuplot.
unset output
$DATA1 << EOD
0 Monday
1 Tuesday
2 Wednesday
3 Thursday
4 Friday
5 Saturday
6 Sunday
EOD
$DATA2 << EOD
0 121.2
1 95.6
2 91.06
3 133.037
4 81.88
5 82.33
6 200.45
EOD
$DATA3 << EOD
0 206.05
1 94.35
2 108.15
3 208.53
4 114.27
5 104.77
6 320.66
EOD
set style data histograms
set style fill pattern
set title "Test"
set term png
set output "test.png"
plot $DATA1 using 1:2 title "day" , $DATA2 using 1:2 title "mean" , $DATA3 using 1:2 title "sd"
unset style data
unset style fill
unset title
unset term
unset output
I'm not sure how to fix it, but it's probably getting unexpected options or the options are in the wrong order.
Running the test script above doesn't raise errors; it just hangs indefinitely. When I kill the job with ctrl-c, the error I get is
/home/Rei/.rvm/gems/ruby-2.4.1/gems/gnuplotrb-0.3.4/lib/gnuplotrb/plot.rb:87:in `sleep': Interrupt
from /home/Rei/.rvm/gems/ruby-2.4.1/gems/gnuplotrb-0.3.4/lib/gnuplotrb/plot.rb:87:in `plot'
from /home/Rei/.rvm/gems/ruby-2.4.1/gems/gnuplotrb-0.3.4/lib/gnuplotrb/mixins/plottable.rb:111:in `to_specific_term'
from /home/Rei/.rvm/gems/ruby-2.4.1/gems/gnuplotrb-0.3.4/lib/gnuplotrb/mixins/plottable.rb:53:in `method_missing'
from script.rb:16:in `<main>'
I'm using ruby 2.4.1, gnuplotrb 0.3.4, on Fedora 25.
@dread-uo, I think you misunderstand or I wasn't completely clear.
The hanging you're seeing and the Interrupt error when you press Ctrl-C is due to a bug (IMO) in GnuplotRB. See the linked issue #14 for more info. By hacking it, I was able to see the true error message of your script, and that's what I showed in my previous comment. Hopefully you can use this real error message to help fix the problem.
Another thing that I've found helpful when debugging is to run gnuplot from the command-line. This will bring up a kind of REPL. You can paste in what's getting sent to gnuplot to see error messages more clearly and try to fix your error.
Activity
ievgrafov commentedon Jan 5, 2017
Hi!
Yeah, unfortunately there is a problem in this particular case because of difference in columns which should be used for lines and histogram plots. When you initialize the plot with
Daru::DataFrameGnuplotRB is building the query for simplest case that is not enough for histogram. However you can control this by hand and in this case use something likeSorry for such a late answer, had problems with github`s 2FA since last summer.
do-you-dare commentedon Jan 8, 2017
Thanks for the reply! Unfortunately, that visualization doesn't suit my needs. Good workaround, tough.
dreammaker commentedon Sep 27, 2017
@dread-uo, here's the error message I got from running your script.
This is what's getting sent to
gnuplot.I'm not sure how to fix it, but it's probably getting unexpected options or the options are in the wrong order.
do-you-dare commentedon Oct 8, 2017
Hello! Thanks for looking at it again!
Running the test script above doesn't raise errors; it just hangs indefinitely. When I kill the job with ctrl-c, the error I get is
I'm using ruby 2.4.1, gnuplotrb 0.3.4, on Fedora 25.
dreammaker commentedon Oct 16, 2017
@dread-uo, I think you misunderstand or I wasn't completely clear.
The hanging you're seeing and the
Interrupterror when you press Ctrl-C is due to a bug (IMO) in GnuplotRB. See the linked issue #14 for more info. By hacking it, I was able to see the true error message of your script, and that's what I showed in my previous comment. Hopefully you can use this real error message to help fix the problem.Another thing that I've found helpful when debugging is to run
gnuplotfrom the command-line. This will bring up a kind of REPL. You can paste in what's getting sent to gnuplot to see error messages more clearly and try to fix your error.