Skip to content

Boxplots don't get drawn properly when there are zeros and it is log transformed #40

Closed
@ctSkennerton

Description

@ctSkennerton

I came across an issue where some parts of the box plot don't get drawn when I log transform data that had a lot of zeroes in it. The image below illustrates what I mean. Having a quick look at the code I can see that cbook.boxplot_stats is returning -inf for some things like IQR or min values which I guess is causing weirdness.

import pandas as pd
from plotnine import *

reprex = pd.DataFrame({'value': [0,0,1,5,100000,4739273,11,0.0001,0, 0.00001,0.00001,1,5,100000,4739273,11,0.0001,0.00001], 
                       'cat':['1','1','1','1','1','1','1','1','1','2','2','2','2','2','2','2','2','2']})
ggplot(reprex, aes('cat', 'value')) + scale_y_log10() + geom_boxplot()

image

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions