Module: ExtendNP
- Included in:
- Numo::Gnuplot::NotePlot
- Defined in:
- lib/gnutemplate.rb
Instance Method Summary collapse
Instance Method Details
#new_to_iruby ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gnutemplate.rb', line 8 def new_to_iruby require 'tempfile' tempfile_svg = Tempfile.open(['plot','.svg']) # output SVG to tmpfile gp = Numo::Gnuplot.default gp.reset gp.unset :multiplot # added gp.set terminal:'svg' gp.set output:tempfile_svg.path gp.instance_eval(&@block) ### gp.unset 'output' # commented out svg = File.read(tempfile_svg.path) tempfile_svg.close ["image/svg+xml",svg] end |