Class: Charty::Plotters::ScatterPlotter

Inherits:
RelationalPlotter show all
Defined in:
lib/charty/plotters/scatter_plotter.rb

Instance Attribute Summary collapse

Attributes inherited from RelationalPlotter

#color_norm, #input_format, #marker_order, #markers, #plot_data, #size, #size_norm, #size_order, #sizes, #style, #var_types, #variables

Attributes inherited from AbstractPlotter

#color, #color_order, #data, #key_color, #palette, #x, #y

Instance Method Summary collapse

Methods inherited from AbstractPlotter

#to_iruby

Constructor Details

#initialize(data: nil, variables: {}, **options, &block) ⇒ ScatterPlotter

Returns a new instance of ScatterPlotter.



4
5
6
7
# File 'lib/charty/plotters/scatter_plotter.rb', line 4

def initialize(data: nil, variables: {}, **options, &block)
  x, y, color, style, size = variables.values_at(:x, :y, :color, :style, :size)
  super(x, y, color, style, size, data: data, **options, &block)
end

Instance Attribute Details

#alphaObject

Returns the value of attribute alpha.



9
10
11
# File 'lib/charty/plotters/scatter_plotter.rb', line 9

def alpha
  @alpha
end

#edge_colorObject

Returns the value of attribute edge_color.



40
41
42
# File 'lib/charty/plotters/scatter_plotter.rb', line 40

def edge_color
  @edge_color
end

#legendObject

Returns the value of attribute legend.



9
10
11
# File 'lib/charty/plotters/scatter_plotter.rb', line 9

def legend
  @legend
end

#line_widthObject

Returns the value of attribute line_width.



40
41
42
# File 'lib/charty/plotters/scatter_plotter.rb', line 40

def line_width
  @line_width
end

Instance Method Details

#renderObject



50
51
52
53
54
55
56
# File 'lib/charty/plotters/scatter_plotter.rb', line 50

def render
  backend = Backends.current
  backend.begin_figure
  draw_points(backend)
  annotate_axes(backend)
  backend.show
end

#save(filename, **opts) ⇒ Object



58
59
60
61
62
63
64
# File 'lib/charty/plotters/scatter_plotter.rb', line 58

def save(filename, **opts)
  backend = Backends.current
  backend.begin_figure
  draw_points(backend)
  annotate_axes(backend)
  backend.save(filename, **opts)
end