Class Gnuplot::DataSet
In: lib/gnuplot.rb
Parent: Object
Plot SPlot DataSet lib/gnuplot.rb Gnuplot dot/m_0_0.png

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

@todo Use the delegator to delegate to the data property.

Methods

new   notitle   plot_args   to_gplot   to_gsplot  

Attributes

data  [RW] 
linewidth  [RW] 
matrix  [RW] 
title  [RW] 
using  [RW] 
with  [RW] 

Public Class methods

[Source]

     # File lib/gnuplot.rb, line 179
179:     def initialize (data = nil)
180:       @data = data
181:       yield self if block_given?
182:     end

Public Instance methods

[Source]

     # File lib/gnuplot.rb, line 184
184:     def notitle
185:       @title = "notitle"
186:     end

[Source]

     # File lib/gnuplot.rb, line 188
188:     def plot_args (io = "")
189:       
190:       # Order of these is important or gnuplot barfs on 'em
191: 
192:       io << ( (@data.instance_of? String) ? @data : "'-'" )
193: 
194:       io << " using #{@using}" if @using
195:       
196:       io << case @title
197:             when /notitle/ then " notitle"
198:             when nil       then ""
199:             else " title '#{@title}'" 
200:             end
201: 
202:       io << " matrix" if @matrix
203:       io << " with #{@with}" if @with
204:       io << " linewidth #{@linewidth}" if @linewidth
205:       io
206:     end

[Source]

     # File lib/gnuplot.rb, line 208
208:     def to_gplot
209:       case @data
210:       when nil then nil
211:       when String then nil
212:       else @data.to_gplot
213:       end
214:     end

[Source]

     # File lib/gnuplot.rb, line 216
216:     def to_gsplot
217:       case @data
218:       when nil then nil
219:       when String then nil
220:       else @data.to_gsplot
221:       end
222:     end

[Validate]