rdp / ruby_gnuplot

The ruby gnuplot gem [gnuplot] [rgnuplot] (official releases of the gnuplot gem are from rdp branch)
BSD 3-Clause "New" or "Revised" License
216 stars 48 forks source link

Plotting Float::NAN values. #27

Open boris-s opened 10 years ago

boris-s commented 10 years ago

It happens that the current version of ruby_gnuplot plots NaN data values as equal to the labels, as in

Gnuplot.open do |gp|
  Gnuplot::Plot.new gp do |plot|
    ary =  [ [0, 1, 2, 3], [ Float::NAN ] * 4 ]
    plot.data << Gnuplot::DataSet.new( ary ) { |set| set.with = "linespoints" }
  end
end

This is misleading. It caused me a long debugging session. The gem should warn and not display the NaN values in the chart at all. There should be a special setting on how to handle Float::NAN and Float::INFINITY values, and only when the user sets this setting explicitly should the warning go away. Btw. congrats to writing a great gem.

boris