Class: RubyPost::CurvedPlot
- Inherits:
-
AbstractPlot
- Object
- Object
- BaseDrawCommand
- AbstractPlot
- RubyPost::CurvedPlot
- 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) ⇒ CurvedPlot
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) ⇒ CurvedPlot
Intitalise with two arrays of the same size.
159 160 161 162 163 |
# File 'lib/simpleplot.rb', line 159 def initialize(x, y) super() @x = x @y = y end |
Instance Method Details
#compile ⇒ Object
165 166 167 168 169 |
# File 'lib/simpleplot.rb', line 165 def compile @p = Path.new.curved @x.each_index{ |i| @p.add_pair(Pair.new(@x[i].cm, @y[i].cm)) } 'draw ' + @p.compile + ' ' + + ";\n" end |
#compilewithscale(xscale, yscale) ⇒ Object
171 172 173 174 175 |
# File 'lib/simpleplot.rb', line 171 def compilewithscale(xscale, yscale) @p = Path.new.curved @x.each_index{ |i| @p.add_pair(Pair.new((@x[i]*xscale).cm, (@y[i]*yscale).cm)) } 'draw ' + @p.compile + ' ' + + ";\n" end |