Class: Gnuplot::DataSet
- Inherits:
-
Object
- Object
- Gnuplot::DataSet
- Defined in:
- lib/gnuplot.rb
Overview
Use the delegator to delegate to the data property.
Container for a single dataset 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.
data
The data that will be plotted. The only requirement is that the object understands the to_gplot method.
The following attributes correspond to their related string in the gnuplot command. See the gnuplot documentation for more information on this.
title, with
Instance Attribute Summary collapse
-
#axes ⇒ Object
Returns the value of attribute axes.
-
#data ⇒ Object
Returns the value of attribute data.
-
#linecolor ⇒ Object
Returns the value of attribute linecolor.
-
#linewidth ⇒ Object
Returns the value of attribute linewidth.
-
#matrix ⇒ Object
Returns the value of attribute matrix.
-
#smooth ⇒ Object
Returns the value of attribute smooth.
-
#title ⇒ Object
Returns the value of attribute title.
-
#using ⇒ Object
Returns the value of attribute using.
-
#with ⇒ Object
Returns the value of attribute with.
Instance Method Summary collapse
-
#initialize(data = nil) {|_self| ... } ⇒ DataSet
constructor
A new instance of DataSet.
- #notitle ⇒ Object
- #plot_args(io = "") ⇒ Object
- #to_gplot ⇒ Object
- #to_gsplot ⇒ Object
Constructor Details
#initialize(data = nil) {|_self| ... } ⇒ DataSet
Returns a new instance of DataSet.
215 216 217 218 219 |
# File 'lib/gnuplot.rb', line 215 def initialize (data = nil) @data = data @title = @with = @using = @linewidth = @linecolor = @matrix = @smooth = @axes = nil # avoid warnings yield self if block_given? end |
Instance Attribute Details
#axes ⇒ Object
Returns the value of attribute axes.
213 214 215 |
# File 'lib/gnuplot.rb', line 213 def axes @axes end |
#data ⇒ Object
Returns the value of attribute data.
213 214 215 |
# File 'lib/gnuplot.rb', line 213 def data @data end |
#linecolor ⇒ Object
Returns the value of attribute linecolor.
213 214 215 |
# File 'lib/gnuplot.rb', line 213 def linecolor @linecolor end |
#linewidth ⇒ Object
Returns the value of attribute linewidth.
213 214 215 |
# File 'lib/gnuplot.rb', line 213 def linewidth @linewidth end |
#matrix ⇒ Object
Returns the value of attribute matrix.
213 214 215 |
# File 'lib/gnuplot.rb', line 213 def matrix @matrix end |
#smooth ⇒ Object
Returns the value of attribute smooth.
213 214 215 |
# File 'lib/gnuplot.rb', line 213 def smooth @smooth end |
#title ⇒ Object
Returns the value of attribute title.
213 214 215 |
# File 'lib/gnuplot.rb', line 213 def title @title end |
#using ⇒ Object
Returns the value of attribute using.
213 214 215 |
# File 'lib/gnuplot.rb', line 213 def using @using end |
#with ⇒ Object
Returns the value of attribute with.
213 214 215 |
# File 'lib/gnuplot.rb', line 213 def with @with end |
Instance Method Details
#notitle ⇒ Object
221 222 223 |
# File 'lib/gnuplot.rb', line 221 def notitle @title = "notitle" end |
#plot_args(io = "") ⇒ Object
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/gnuplot.rb', line 225 def plot_args (io = "") # Order of these is important or gnuplot barfs on 'em io << ( (@data.instance_of? String) ? @data : "'-'" ) io << " using #{@using}" if @using io << " axes #{@axes}" if @axes io << case @title when /notitle/ then " notitle" when nil then "" else " title '#{@title}'" end io << " matrix" if @matrix io << " smooth #{@smooth}" if @smooth io << " with #{@with}" if @with io << " linecolor #{@linecolor}" if @linecolor io << " linewidth #{@linewidth}" if @linewidth io end |
#to_gplot ⇒ Object
249 250 251 252 253 254 255 |
# File 'lib/gnuplot.rb', line 249 def to_gplot case @data when nil then nil when String then nil else @data.to_gplot end end |
#to_gsplot ⇒ Object
257 258 259 260 261 262 263 |
# File 'lib/gnuplot.rb', line 257 def to_gsplot case @data when nil then nil when String then nil else @data.to_gsplot end end |