Class: RubyPost::ImpulsePlot
- Inherits:
-
AbstractPlot
- Object
- Object
- BaseDrawCommand
- AbstractPlot
- RubyPost::ImpulsePlot
- Defined in:
- lib/simpleplot.rb
Instance Attribute Summary
Attributes inherited from AbstractPlot
Attributes inherited from BaseDrawCommand
Instance Method Summary collapse
- #compile ⇒ Object
- #compilewithscale(xscale, yscale) ⇒ Object
-
#initialize(x, y) ⇒ ImpulsePlot
constructor
Intitalise with two arrays of the same size.
Methods inherited from AbstractPlot
Methods inherited from BaseDrawCommand
#add_option, #color, #colour, #compile_options, #rotate, #scale, #set_drawable, #translate
Constructor Details
#initialize(x, y) ⇒ ImpulsePlot
Intitalise with two arrays of the same size.
182 183 184 185 186 |
# File 'lib/simpleplot.rb', line 182 def initialize(x, y) super() @x = x @y = y end |
Instance Method Details
#compile ⇒ Object
188 189 190 191 192 193 194 |
# File 'lib/simpleplot.rb', line 188 def compile str = '' @x.each_index{ |i| str = str + 'drawarrow (' + @x[i].to_s + 'cm, 0)--(' + @x[i].to_s + 'cm, ' + @y[i].to_s + 'cm) ' + + ";\n" } return str end |
#compilewithscale(xscale, yscale) ⇒ Object
196 197 198 199 200 201 202 |
# File 'lib/simpleplot.rb', line 196 def compilewithscale(xscale, yscale) str = '' @x.each_index{ |i| str = str + 'drawarrow (' + (@x[i]*xscale).to_s + 'cm, 0)--(' + (@x[i]*xscale).to_s + 'cm, ' + (@y[i]*yscale).to_s + 'cm) ' + + ";\n" } return str end |