class Nyaplot::CircularPlot
Public Class Methods
new(df, group_label, nested_label)
click to toggle source
@param [DataFrame] df @param [Symbol] group_label The column which contains names of groups @param [Symbol] nested_label The column which contains dataframe
Calls superclass method
# File lib/bionya/plot.rb, line 27 def initialize(df, group_label, nested_label) super() @df = df @inner_num = 0 @outer_num = 1 @nested_label = nested_label set_property(:axis_extra_options, {}) group_by(group_label) color(['#253494']) extension('Bionya') end
Public Instance Methods
add(layer, type, *labels)
click to toggle source
Add diagram to the plot @param [Numeric] layer The number of layer where the plot is placed (0 is the grouped arc, 1, 2, … are the outside of circle, -1, -2, .. is the inside of circle) @param [Symbol] type The type of plot to add @param [Array<Symbol>] labels @return [Diagram]
# File lib/bionya/plot.rb, line 63 def add(layer, type, *labels) if(layer>0) @outer_num += 1 elsif @inner_num += 1 end diagram = Diagram.new(@df, type, labels.push(@nested_label)) diagram.layer(layer) @axis = diagram.x self.diagrams.push(diagram) return diagram end
add_chord(matrix)
click to toggle source
Add chord to the plot @param [Array<Array>] matrix @see github.com/mbostock/d3/wiki/Chord-Layout
# File lib/bionya/plot.rb, line 43 def add_chord(matrix) @matrix = matrix end
add_connector_with_df(df, from, to)
click to toggle source
Add connector to the plot @param [DataFrame] df @param [Symbol] from the column label @param [Symbol] to the column label @return [Diagram]
# File lib/bionya/plot.rb, line 52 def add_connector_with_df(df, from, to) diagram = Diagram.new(df, :connector, [from, to]) self.diagrams.push(diagram) return diagram end
before_to_json()
click to toggle source
# File lib/bionya/plot.rb, line 77 def before_to_json zoom(true) width(800) if width.nil? height(800) if height.nil? inner_num(@inner_num) outer_num(@outer_num) df_id(@df.name) axis(@axis) self.options[:axis_extra_options] = axis_extra_options end