Method: Gnuplot::Plot#initialize

Defined in:
lib/gnuplot.rb

#initialize(io = nil, cmd = "plot") {|_self| ... } ⇒ Plot

Returns a new instance of Plot.

Yields:

  • (_self)

Yield Parameters:

  • _self (Gnuplot::Plot)

    the object that the method was called on



95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/gnuplot.rb', line 95

def initialize (io = nil, cmd = "plot")
  @cmd = cmd
  @settings = []
  @arbitrary_lines = []
  @data = []
  yield self if block_given?
  puts "writing this to gnuplot:\n" + to_gplot + "\n" if $VERBOSE

  if io    
    io << to_gplot
    io << store_datasets
  end
end