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.



101
102
103
# File 'lib/gnuplot.rb', line 101

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



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/gnuplot.rb', line 105

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