Class: Charty::Plotters::AbstractPlotter

Inherits:
Object
  • Object
show all
Defined in:
lib/charty/plotters/abstract_plotter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, color, **options) {|_self| ... } ⇒ AbstractPlotter

Returns a new instance of AbstractPlotter.

Yields:

  • (_self)

Yield Parameters:



4
5
6
7
8
9
10
11
12
# File 'lib/charty/plotters/abstract_plotter.rb', line 4

def initialize(x, y, color, **options)
  self.x = x
  self.y = y
  self.color = color
  self.data = data
  self.palette = palette
  substitute_options(options)
  yield self if block_given?
end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



14
15
16
# File 'lib/charty/plotters/abstract_plotter.rb', line 14

def color
  @color
end

#color_orderObject

Returns the value of attribute color_order.



15
16
17
# File 'lib/charty/plotters/abstract_plotter.rb', line 15

def color_order
  @color_order
end

#dataObject

Returns the value of attribute data.



14
15
16
# File 'lib/charty/plotters/abstract_plotter.rb', line 14

def data
  @data
end

#key_colorObject

Returns the value of attribute key_color.



15
16
17
# File 'lib/charty/plotters/abstract_plotter.rb', line 15

def key_color
  @key_color
end

#paletteObject

Returns the value of attribute palette.



15
16
17
# File 'lib/charty/plotters/abstract_plotter.rb', line 15

def palette
  @palette
end

#xObject

Returns the value of attribute x.



14
15
16
# File 'lib/charty/plotters/abstract_plotter.rb', line 14

def x
  @x
end

#yObject

Returns the value of attribute y.



14
15
16
# File 'lib/charty/plotters/abstract_plotter.rb', line 14

def y
  @y
end

Instance Method Details

#inspectObject



17
18
19
# File 'lib/charty/plotters/abstract_plotter.rb', line 17

def inspect
  "#<#{self.class}:0x%016x>" % self.object_id
end

#render(notebook: false, **kwargs) ⇒ Object



161
162
163
164
165
166
# File 'lib/charty/plotters/abstract_plotter.rb', line 161

def render(notebook: false, **kwargs)
  backend = Backends.current
  backend.begin_figure
  render_plot(backend, notebook: notebook, **kwargs)
  backend.render(notebook: notebook, **kwargs)
end

#save(filename, **kwargs) ⇒ Object



154
155
156
157
158
159
# File 'lib/charty/plotters/abstract_plotter.rb', line 154

def save(filename, **kwargs)
  backend = Backends.current
  backend.begin_figure
  render_plot(backend, **kwargs)
  backend.save(filename, **kwargs)
end

#to_irubyObject



173
174
175
# File 'lib/charty/plotters/abstract_plotter.rb', line 173

def to_iruby
  render(notebook: iruby_notebook?)
end