endangeredoxen / fivecentplots

A Python plotting analgesic
https://endangeredoxen.github.io/fivecentplots
11 stars 6 forks source link

boxplots: passing groups=None #68

Closed selting closed 7 months ago

selting commented 8 months ago

When passing groups=None for the boxplot function, the execution fails although None is specified as the default in the docs: https://endangeredoxen.github.io/fivecentplots/0.5.3/api/grouping.html

MWE:

import fivecentplots as fcp
import matplotlib.pyplot as plt
import pandas as pd

df = pd.read_csv(
    'https://gist.githubusercontent.com/seankross/a412dfbd88b3db70b74b/raw/5f23f993cd87c283ce766e7ac6b329ee7cc2e1d1/mtcars.csv')

fcp.boxplot(
    df,
    y='mpg',
    groups=None,
)

This is because fcp calls layout.add_box_labels() although no groups are available: https://github.com/endangeredoxen/fivecentplots/blob/main/src/fivecentplots/fcp.py#L1592 When omitting the group keyword argument altogether, it works as expected.