Skip to content

geom_boxplot ignores the weight aesthetic #438

@skasch

Description

@skasch

It seems like geom_boxplot does not take the weight aesthetic into account.

Expected behavior

Using the weight aesthetic with geom_boxplot weights the values in the dataset.

Actual behavior

geom_boxplot behaves as if weight was passed 1, even when passed a specific column.

Steps to reproduce

Here is a minimal snippet to reproduce the problem:

import pandas as pd
import plotnine as pn

df1 = pd.DataFrame(dict(value=[1,2,3,4,5,6,7,8,9,10], weight=[1,1,1,1,1,2,2,2,2,2]))
df2 = pd.DataFrame(dict(value=[1,2,3,4,5,6,6,7,7,8,8,9,9,10,10]))

plot1 = pn.ggplot(df, pn.aes(x=1, y="value", weight="weight")) + pn.geom_boxplot()
plot2 = pn.ggplot(df2, pn.aes(x=1, y="value")) + pn.geom_boxplot()

plot1 gives the same plot as pn.ggplot(df, pn.aes(x=1, y="value")) + pn.geom_boxplot(), when it is expected to give the same plot as plot2.

Specifications

  • Version: plotnine==0.7.1
  • Python version: Python 3.8.2
  • Platform: Ubuntu 20.04.1 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions