| Class | Gnuplot::DataSet |
| In: |
lib/gnuplot.rb
|
| Parent: | Object |
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.
| data | [RW] | |
| linewidth | [RW] | |
| matrix | [RW] | |
| title | [RW] | |
| using | [RW] | |
| with | [RW] |
# File lib/gnuplot.rb, line 179
179: def initialize (data = nil)
180: @data = data
181: yield self if block_given?
182: end
# 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
# 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