class Plotly::Plot

Attributes

data[R]

@!attribute [r] data

@return [Array] list of Plotly::Data objects

@!attribute [r] layout

@return [Plotly::Layout]
layout[R]

@!attribute [r] data

@return [Array] list of Plotly::Data objects

@!attribute [r] layout

@return [Plotly::Layout]

Public Class Methods

new(data: [], layout: {}) click to toggle source

@option data [Array] list of Hash or Plotly::Data objects @option layout [Hash or Plotly::Layout]

# 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

Public Instance Methods

data=(data) click to toggle source

@param data [Array] list of Hash or Plotly::Data objects

# File lib/plotly/plot.rb, line 25
def data=(data)
  raise unless data.is_a?(Array)
  @data = data.map { |d| d.convert_to(Plotly::Data) }
end
layout=(layout) click to toggle source

@param layout [Hash or Plotly::Layout]

# File lib/plotly/plot.rb, line 31
def layout=(layout)
  @layout = layout.convert_to(Plotly::Layout)
end