Class: Plotly::Plot

Inherits:
Object show all
Includes:
Exportable, Offline::Exportable
Defined in:
lib/plotly/plot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Offline::Exportable

#generate_html, #show, #to_html

Methods included from Exportable

#download_image

Constructor Details

#initialize(data: [], layout: {}) ⇒ Plot

Returns a new instance of Plot.

Parameters:

  • data (Hash) (defaults to: [])

    a customizable set of options

  • layout (Hash) (defaults to: {})

    a customizable set of options

Options Hash (data:):

  • list (Array)

    of Hash or Plotly::Data objects

Options Hash (layout:):



19
20
21
22
# File 'lib/plotly/plot.rb', line 19

def initialize(data: [], layout: {})
  @data   = data.map { |d| d.is_a?(Hash) ? Data.new(d) : d }
  @layout = layout.convert_to(Plotly::Layout)
end

Instance Attribute Details

#dataArray

Returns list of Plotly::Data objects.

Returns:

  • (Array)

    list of Plotly::Data objects



15
16
17
# File 'lib/plotly/plot.rb', line 15

def data
  @data
end

#layoutObject

Returns the value of attribute layout.



15
# File 'lib/plotly/plot.rb', line 15

attr_reader :data, :layout