Sha256: 57b789bf38e4eca4dec023f8d5e2e0699719871e52814da46521cc74e6f36412
Contents?: true
Size: 979 Bytes
Versions: 1
Compression:
Stored size: 979 Bytes
Contents
require 'daru' require 'daru/plotly/category' require 'daru/plotly/dataframe' require 'daru/plotly/vector' require 'daru/plotly/methods' module Daru # Common methods for DataFrame and Vector module Plotly def plot(source, opts = {}) data = opts[:data] || generate_data(source, opts) layout = default_layout.merge(opts[:layout] || {}) plot = ::Plotly::Plot.new(data: data, layout: layout) yield plot if block_given? plot end def default_layout { width: 1000, height: 500 } end def extract_mode_string(modes) (Array(modes) || [:markers]).map(&:to_s).join('+') end def extract_type(plot_type) case plot_type when nil :scatter when *supported_types plot_type else raise ArgumentError, "Type must be included in #{supported_types}." end end module_function :default_layout, :extract_mode_string, :extract_type end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
daru-plotly-0.2.0 | lib/daru/plotly.rb |