Class: Charty::Plotters::BoxPlotter
- Inherits:
-
CategoricalPlotter
- Object
- AbstractPlotter
- CategoricalPlotter
- Charty::Plotters::BoxPlotter
- Defined in:
- lib/charty/plotters/box_plotter.rb
Instance Attribute Summary collapse
-
#flier_size ⇒ Object
Returns the value of attribute flier_size.
-
#line_width ⇒ Object
Returns the value of attribute line_width.
-
#whisker ⇒ Object
Returns the value of attribute whisker.
Attributes inherited from CategoricalPlotter
#dodge, #group_label, #group_names, #order, #orient, #plot_data, #saturation, #value_label, #width
Attributes included from EstimationSupport
#ci, #estimator, #n_boot, #units
Attributes included from RandomSupport
Attributes inherited from AbstractPlotter
#color, #color_order, #data, #key_color, #palette, #x, #y
Instance Method Summary collapse
-
#initialize(data: nil, variables: {}, **options, &block) ⇒ BoxPlotter
constructor
A new instance of BoxPlotter.
- #render ⇒ Object
-
#save(filename, **opts) ⇒ Object
TODO: - Should infer mime type from file’s extname - Should check backend’s supported mime type before begin_figure.
Methods included from EstimationSupport
Methods included from RandomSupport
Methods inherited from AbstractPlotter
Constructor Details
#initialize(data: nil, variables: {}, **options, &block) ⇒ BoxPlotter
Returns a new instance of BoxPlotter.
7 8 9 10 |
# File 'lib/charty/plotters/box_plotter.rb', line 7 def initialize(data: nil, variables: {}, **, &block) x, y, color = variables.values_at(:x, :y, :color) super(x, y, color, data: data, **, &block) end |
Instance Attribute Details
#flier_size ⇒ Object
Returns the value of attribute flier_size.
12 13 14 |
# File 'lib/charty/plotters/box_plotter.rb', line 12 def flier_size @flier_size end |
#line_width ⇒ Object
Returns the value of attribute line_width.
18 19 20 |
# File 'lib/charty/plotters/box_plotter.rb', line 18 def line_width @line_width end |
#whisker ⇒ Object
Returns the value of attribute whisker.
24 25 26 |
# File 'lib/charty/plotters/box_plotter.rb', line 24 def whisker @whisker end |
Instance Method Details
#render ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/charty/plotters/box_plotter.rb', line 30 def render backend = Backends.current backend.begin_figure draw_box_plot(backend) annotate_axes(backend) backend.invert_yaxis if orient == :h backend.show end |
#save(filename, **opts) ⇒ Object
TODO:
-
Should infer mime type from file’s extname
-
Should check backend’s supported mime type before begin_figure
42 43 44 45 46 47 48 49 |
# File 'lib/charty/plotters/box_plotter.rb', line 42 def save(filename, **opts) backend = Backends.current backend.begin_figure draw_box_plot(backend) annotate_axes(backend) backend.invert_yaxis if orient == :h backend.save(filename, **opts) end |