Class: DataSet

Inherits:
Object
  • Object
show all
Defined in:
lib/grada/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:

  • _self (DataSet)

    the object that the method was called on



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/grada/gnuplot.rb', line 162

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.



158
159
160
# File 'lib/grada/gnuplot.rb', line 158

def axes
  @axes
end

#dataObject

Returns the value of attribute data.



158
159
160
# File 'lib/grada/gnuplot.rb', line 158

def data
  @data
end

#indexObject

Returns the value of attribute index.



158
159
160
# File 'lib/grada/gnuplot.rb', line 158

def index
  @index
end

#linecolorObject

Returns the value of attribute linecolor.



158
159
160
# File 'lib/grada/gnuplot.rb', line 158

def linecolor
  @linecolor
end

#linestyleObject Also known as: ls

Returns the value of attribute linestyle.



158
159
160
# File 'lib/grada/gnuplot.rb', line 158

def linestyle
  @linestyle
end

#linewidthObject

Returns the value of attribute linewidth.



158
159
160
# File 'lib/grada/gnuplot.rb', line 158

def linewidth
  @linewidth
end

#matrixObject

Returns the value of attribute matrix.



158
159
160
# File 'lib/grada/gnuplot.rb', line 158

def matrix
  @matrix
end

#smoothObject

Returns the value of attribute smooth.



158
159
160
# File 'lib/grada/gnuplot.rb', line 158

def smooth
  @smooth
end

#titleObject

Returns the value of attribute title.



158
159
160
# File 'lib/grada/gnuplot.rb', line 158

def title
  @title
end

#usingObject

Returns the value of attribute using.



158
159
160
# File 'lib/grada/gnuplot.rb', line 158

def using
  @using
end

#withObject

Returns the value of attribute with.



158
159
160
# File 'lib/grada/gnuplot.rb', line 158

def with
  @with
end

Instance Method Details

#notitleObject



178
179
180
# File 'lib/grada/gnuplot.rb', line 178

def notitle
  '"No Title"'
end

#plot_args(io = '') ⇒ Object



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/grada/gnuplot.rb', line 182

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



198
199
200
201
202
# File 'lib/grada/gnuplot.rb', line 198

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

  @data.to_gplot
end