Module: Plot

Defined in:
lib/redshift/util/plot.rb

Overview

Interface to gnuplot and, eventually, other plotting apps.

Defined Under Namespace

Modules: PlotUtils Classes: GenericPlot, Gnuplot

Class Method Summary collapse

Class Method Details

.new(app = ENV['PLOTTER'] || 'gnuplot') {|plot| ... } ⇒ Object

app is the name of the plot program. Yields and returns the plot instance. Use the #add, #command, and #show methods on this object.

Yields:

  • (plot)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/redshift/util/plot.rb', line 7

def Plot.new(app = ENV['PLOTTER'] || 'gnuplot', &block)
  plot =
    case app
    when /gnuplot/i
      Gnuplot.new app

    when /^matlab/i
      raise "matlab not supported yet.\n  Try 'gnuplot'."

    else
      raise "Plot doesn't recognize '#{app}'.\n  Try 'gnuplot'."
    end
  yield plot if block_given?
  plot
end