Class: Gnuplot::SPlot

Inherits:
Plot
  • Object
show all
Defined in:
lib/gnuplot.rb

Constant Summary

Constants inherited from Plot

Plot::QUOTED

Instance Attribute Summary

Attributes inherited from Plot

#cmd, #data, #sets

Instance Method Summary collapse

Methods inherited from Plot

#[], #add_data, #method_missing, #set

Constructor Details

#initialize(io = nil, cmd = "splot") ⇒ SPlot

Returns a new instance of SPlot.



152
153
154
# File 'lib/gnuplot.rb', line 152

def initialize (io = nil, cmd = "splot")
  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Gnuplot::Plot

Instance Method Details

#to_gplot(io = "") ⇒ Object



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/gnuplot.rb', line 156

def to_gplot (io = "")
  @sets.each { |var, val| io << "set #{var} #{val}\n" }

  if @data.size > 0 then
    io << @cmd << " " 
    io << @data.collect { |e| e.plot_args }.join(", ")
    io << "\n"

    @data.each do |ds| 
      io << ds.to_gsplot << "e\n"
    end
  end

  io
end