module Mirlo::Plotting
Public Instance Methods
plot(x_feature = nil, y_feature = nil)
click to toggle source
# File lib/mirlo/plotting.rb, line 3 def plot(x_feature = nil, y_feature = nil) Gnuplot.open do |gp| Gnuplot::Plot.new(gp) do |plot| plot.title title plot.xlabel 'x' plot.ylabel 'y' plot.data = to_gnu_plot_datasets end end end
Private Instance Methods
to_gnu_plot_datasets()
click to toggle source
# File lib/mirlo/plotting.rb, line 17 def to_gnu_plot_datasets target_set.each_with_index.collect do |target, i| subset = subset_with_target(target) x = subset.feature(0) y = subset.feature(1) Gnuplot::DataSet.new([x, y]) do |ds| ds.title = label_for(target) ds.with = "points ls #{i+1} lc rgb \"red\"" end end end