Open
Description
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.
require 'daru'
require 'gnuplotrb'
include GnuplotRB
days = %w(Monday Tuesday Wednesday Thursday Friday Saturday Sunday)
mean = [121.2, 95.6, 91.06, 133.037, 81.88, 82.33, 200.45]
std = [206.05, 94.35, 108.15, 208.53, 114.27, 104.77, 320.66]
cdata = Daru::DataFrame.new({ day: days, mean: mean, sd: std }, name: "test")
plot = Plot.new(cdata,
style_data: 'histograms',
style_fill: 'pattern',
title: "Test")
plot.to_png 'test.png'
If I change style_data
to lines
, it works as expected.
I'm using Ruby 2.3.0, with gnuplotrb 0.3.4 and daru 0.1.4.1. Gnuplot is version 5.0 patchlevel 3.
Thanks for your work with this :)
Metadata
Metadata
Assignees
Labels
No labels
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::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 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
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.