Skip to content

[Nuisance issue] Using Gnuplot prints correct graph, also throws error #321

@Xasin

Description

@Xasin

Dear IRuby maintainer team,

I ran into a minor issue (annoyance, does not seem to actually impact functionality) with using Gnuplot.

The issue:
Gnuplot will correctly render the graph and insert output below the cell.
However, IRuby also throws an error below it. The kernel continues execution as normal and the graph remains, the only issue is the fact that the error message clutters output.

Reproduction:
Using the minimal gnuplot example as given in the example notebook:

require 'gnuplot'

Gnuplot::Plot.new() do |plot|
  
    plot.title  "Array Plot Example"
    plot.xlabel "x"
    plot.ylabel "x^2"
    
    x = (0..50).collect { |v| v.to_f }
    y = x.collect { |v| v ** 2 }

    plot.data << Gnuplot::DataSet.new( [x, y] ) do |ds|
      ds.with = "linespoints"
      ds.notitle
    end
  end

Output:
image

Execution continues as normal after this.

Versions:

  • ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux-gnu]
  • Jupyter:
IPython          : 8.4.0
ipykernel        : 6.15.0
ipywidgets       : not installed
jupyter_client   : 7.3.4
jupyter_core     : 4.10.0
jupyter_server   : 1.18.0
jupyterlab       : 3.4.3
nbclient         : 0.6.4
nbconvert        : 6.5.0
nbformat         : 5.4.0
notebook         : 6.4.12
qtconsole        : not installed
traitlets        : 5.3.0
  • gnuplot gem (2.6.2)
  • gnuplot apt package 5.4.1+dfsg1-1+deb11u1
  • iruby (0.7.4)

No further output in the console running Jupyter was seen.
As such, this is mostly a nuisance issue, but can be confusing, as it is expected that the given minimal examples work without throwing errors.

Note that the error message IS correct.
Calling to_hash returns a key-value pair array.
This might be a subtle version incompatibility between IRuby and the gnuplot gem that I am using. Perhaps a small check to convert the returned array ((which really should be a hash, why to_hash returns a key-value pair array is a mystery to me)) to a hash would already fix this.

The returned array looks like this:
[[:set, "title", "\"Array Plot Example\""], [:set, "xlabel", "\"x\""], [:set, "ylabel", "\"x^2\""], [:set, "to_hash", ""]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions