Class: Grada::Gnuplot::DataSet

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = nil) {|_self| ... } ⇒ DataSet

Returns a new instance of DataSet.

Yields:

  • (_self)

Yield Parameters:



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/grada/types/gnuplot.rb', line 168

def initialize(data = nil)
  @data = data
  @linestyle = nil
  @title = nil
  @with = nil
  @using = nil
  @linewidth = nil
  @linecolor = nil 
  @matrix = nil
  @smooth = nil
  @axes = nil
  @index = nil
  
  yield self if block_given?
end

Instance Attribute Details

#axesObject

Returns the value of attribute axes.



164
165
166
# File 'lib/grada/types/gnuplot.rb', line 164

def axes
  @axes
end

#dataObject

Returns the value of attribute data.



164
165
166
# File 'lib/grada/types/gnuplot.rb', line 164

def data
  @data
end

#indexObject

Returns the value of attribute index.



164
165
166
# File 'lib/grada/types/gnuplot.rb', line 164

def index
  @index
end

#linecolorObject

Returns the value of attribute linecolor.



164
165
166
# File 'lib/grada/types/gnuplot.rb', line 164

def linecolor
  @linecolor
end

#linestyleObject Also known as: ls

Returns the value of attribute linestyle.



164
165
166
# File 'lib/grada/types/gnuplot.rb', line 164

def linestyle
  @linestyle
end

#linewidthObject

Returns the value of attribute linewidth.



164
165
166
# File 'lib/grada/types/gnuplot.rb', line 164

def linewidth
  @linewidth
end

#matrixObject

Returns the value of attribute matrix.



164
165
166
# File 'lib/grada/types/gnuplot.rb', line 164

def matrix
  @matrix
end

#smoothObject

Returns the value of attribute smooth.



164
165
166
# File 'lib/grada/types/gnuplot.rb', line 164

def smooth
  @smooth
end

#titleObject

Returns the value of attribute title.



164
165
166
# File 'lib/grada/types/gnuplot.rb', line 164

def title
  @title
end

#usingObject

Returns the value of attribute using.



164
165
166
# File 'lib/grada/types/gnuplot.rb', line 164

def using
  @using
end

#withObject

Returns the value of attribute with.



164
165
166
# File 'lib/grada/types/gnuplot.rb', line 164

def with
  @with
end

Instance Method Details

#notitleObject



184
185
186
# File 'lib/grada/types/gnuplot.rb', line 184

def notitle
  '"No Title"'
end

#plot_args(io = '') ⇒ Object



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/grada/types/gnuplot.rb', line 188

def plot_args(io = '')
  io += @data.is_a?(String) ? @data : "'-'"
  #io += " index #{@index}" if @index
  io += " using #{@using}" if @using
  io += " axes #{@axes}" if @axes
  io += " title #{@title ? "\"#{@title}\"" : notitle}"
  io += " matrix #{@matrix}" if @matrix
  io += " smooth  #{@smooth}" if @smooth
  io += " with #{@with}" if @with
  io += " linecolor #{@linecolor}" if @linecolor
  io += " line #{@index} linewidth #{@linewidth}" if @linewidth
  io += " linestyle #{@linestyle.index}" if @linestyle
  
  io
end

#to_gplotObject



204
205
206
207
208
# File 'lib/grada/types/gnuplot.rb', line 204

def to_gplot
  return nil if @data.nil? || @data.is_a?(String)
  
  @data.to_gplot
end