Skip to content

Nyaplot uses index as default axis for vector but not for dataframe #6

@baarkerlounger

Description

@baarkerlounger
df = Daru::DataFrame.new({y1: [11, 15, 8], y2: [9, 10, 3]}, 
     index: ["a", "b", "c"])
df.plot type: :bar, y: :y1 do |plot, diagram|
  plot.y_label "Frequency"
  plot.x_label "Category"
  plot.yrange [0,20]
end

Throws NoMethodError: undefined method to_sym' for nil:NilClass`

I would expect it to behave like Daru::Vector and take the index as default axis.

dv = df[:y1]
dv.plot type: :bar, y: :y1 do |plot, diagram|
  plot.y_label "Frequency"
  plot.x_label "Category"
  plot.yrange [0,20]
end

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions