Method: Nyaplot::Plot3D#add_with_df

Defined in:
lib/nyaplot3d/plot3d.rb

#add_with_df(df, type, *labels) ⇒ Object

Add diagram with DataFrame

Examples:

df = Nyaplot::DataFrame.new({x: [0,1,2], y: [0,1,2], z: [0,1,2]})
plot.add(df, :surface, :x, :y, :z)

Parameters:

  • DataFrame (DataFrame)

    from which diagram is created

  • type (Symbol)

    the type of diagram to add

  • *labels (Array<Symbol>)

    column labels for x, y or some other dimension


37
38
39
40
41
42
# File 'lib/nyaplot3d/plot3d.rb', line 37

def add_with_df(df, type, *labels)
  diagram = Diagram3D.new(df, type, labels)
  diagrams = get_property(:diagrams)
  diagrams.push(diagram)
  return diagram
end