Class: Gnuplot::DataSet

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

Overview

Container for a single data set being displayed by GNUPLOT. Each object has a reference to the actual data being plotted as well as settings that control the plot command. The data object must support the to_gplot command.

The other attributes correspond to their related string in the GNUPLOT command. See the GNUPLOT documentation for more information on this.

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:



223
224
225
226
# File 'lib/gnuplot.rb', line 223

def initialize(data = nil)
  @data = data
  yield self if block_given?
end

Instance Attribute Details

#axesObject

Returns the value of attribute axes.



221
222
223
# File 'lib/gnuplot.rb', line 221

def axes
  @axes
end

#dataObject

Returns the value of attribute data.



221
222
223
# File 'lib/gnuplot.rb', line 221

def data
  @data
end

#linewidthObject

Returns the value of attribute linewidth.



221
222
223
# File 'lib/gnuplot.rb', line 221

def linewidth
  @linewidth
end

#matrixObject

Returns the value of attribute matrix.



221
222
223
# File 'lib/gnuplot.rb', line 221

def matrix
  @matrix
end

#smoothObject

Returns the value of attribute smooth.



221
222
223
# File 'lib/gnuplot.rb', line 221

def smooth
  @smooth
end

#titleObject

Returns the value of attribute title.



221
222
223
# File 'lib/gnuplot.rb', line 221

def title
  @title
end

#usingObject

Returns the value of attribute using.



221
222
223
# File 'lib/gnuplot.rb', line 221

def using
  @using
end

#withObject

Returns the value of attribute with.



221
222
223
# File 'lib/gnuplot.rb', line 221

def with
  @with
end

Instance Method Details

#notitleObject

Set no title.



229
230
231
# File 'lib/gnuplot.rb', line 229

def notitle
  @title = 'notitle'
end

#plot_args(io = '') ⇒ Object

Write the plot arguments to io.



234
235
236
237
238
239
240
241
# File 'lib/gnuplot.rb', line 234

def plot_args(io = '')
  # Order of these is important or GNUPLOT barfs on 'em
  %w[data using axes title matrix smooth with linewidth].each { |arg|
    plot_arg(io, arg)
  }

  io
end

#to_gplot(io = '') ⇒ Object

Write the plot data to io.



244
245
246
# File 'lib/gnuplot.rb', line 244

def to_gplot(io = '')
  @data.to_gplot(io) if plot?
end

#to_gsplot(io = '') ⇒ Object

Write the splot data to io.



249
250
251
# File 'lib/gnuplot.rb', line 249

def to_gsplot(io = '')
  @data.to_gsplot(io) if plot?
end