Class: Rubydown::RbMarkPlot

Inherits:
Numo::Gnuplot
  • Object
show all
Defined in:
lib/rubydown.rb

Instance Method Summary collapse

Instance Method Details

#_plot_splot(*args) ⇒ Object



56
57
58
59
60
61
# File 'lib/rubydown.rb', line 56

def _plot_splot(*args)
  @tempfile = Tempfile.open(['plot', '.png'])
  set terminal: 'png'
  set output: @tempfile.path
  super(*args)
end

#plot(*args) ⇒ Object



46
47
48
49
# File 'lib/rubydown.rb', line 46

def plot(*args)
  super(*args)
  self
end

#splot(*args) ⇒ Object



51
52
53
54
# File 'lib/rubydown.rb', line 51

def splot(*args)
  super(*args)
  self
end

#to_htmlObject



63
64
65
66
67
68
# File 'lib/rubydown.rb', line 63

def to_html
  img_b64 = Base64.encode64(File.binread(@tempfile))
  <<-HTML
    <img src='data:image/png;base64,#{img_b64}' />
  HTML
end