Method: Charty::PlotMethods#scatter_plot

Defined in:
lib/charty/plot_methods.rb

#scatter_plot(x: nil, y: nil, color: nil, style: nil, size: nil, data: nil, key_color: nil, palette: nil, color_order: nil, color_norm: nil, sizes: nil, size_order: nil, size_norm: nil, markers: true, style_order: nil, alpha: nil, legend: :auto, **options, &block) ⇒ Object

Scatter plot

Parameters:

  • x (vector-like object, key in data) (defaults to: nil)
  • y (vector-like object, key in data) (defaults to: nil)
  • color (vector-like object, key in data) (defaults to: nil)
  • style (vector-like object, key in data) (defaults to: nil)
  • size (vector-like object, key in data) (defaults to: nil)
  • data (table-like object) (defaults to: nil)
  • key_color (color object) (defaults to: nil)
  • palette (String, Array<Numeric>, Palette) (defaults to: nil)
  • color_order (Array<String>, Array<Symbol>) (defaults to: nil)
  • color_norm (defaults to: nil)
  • sizes (Array, Hash) (defaults to: nil)
  • size_order (Array) (defaults to: nil)
  • size_norm (defaults to: nil)
  • markers (true, false, Array, Hash) (defaults to: true)
  • style_order (Array) (defaults to: nil)
  • alpha (scalar number) (defaults to: nil)

    Propotional opacity of the points.

  • legend (:auto, :brief, :full, false) (defaults to: :auto)

    How to draw legend. If :brief, numeric color and size variables will be represented with a sample of evenly spaced values. If :full, every group will get an entry in the legend. If :auto, choose between brief or full representation based on number of levels. If false, no legend data is added and no legend is drawn.



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/charty/plot_methods.rb', line 228

def scatter_plot(x: nil, y: nil, color: nil, style: nil, size: nil,
                 data: nil, key_color: nil, palette: nil, color_order: nil,
                 color_norm: nil, sizes: nil, size_order: nil, size_norm: nil,
                 markers: true, style_order: nil, alpha: nil, legend: :auto,
                 **options, &block)
  Plotters::ScatterPlotter.new(
    data: data,
    variables: { x: x, y: y, color: color, style: style, size: size },
    key_color: key_color,
    palette: palette,
    color_order: color_order,
    color_norm: color_norm,
    sizes: sizes,
    size_order: size_order,
    size_norm: size_norm,
    markers: markers,
    style_order: style_order,
    alpha: alpha,
    legend: legend,
    **options,
    &block
  )
end