statannot
statannot copied to clipboard
Crash for barplots
There is a crash when trying to plot annotations for a barplot in statannot-0.2.3
and seaborn-0.10.0
.
Consider the following code:
import numpy as np
import pandas as pd
import statannot
import seaborn as sns
import matplotlib.pyplot as plt
np.random.seed(42)
df = pd.DataFrame({
'y': np.random.random(size=50),
'x': np.random.choice(['X1', 'X2'], size=50),
})
ax = sns.barplot(x='x', y='y', data=df)
statannot.add_stat_annotation(
ax, plot='barplot',
data=df, x='x', y='y',
box_pairs=[('X1', 'X2')],
test='Mann-Whitney', text_format='simple'
)
plt.show()
It crashes with the error
Traceback (most recent call last):
File "test.py", line 21, in <module>
test='Mann-Whitney', text_format='simple'
File "../python/site-packages/statannot/statannot.py", line 442, in add_stat_annotation
errcolor=".26", errwidth=None, capsize=None, dodge=True)
TypeError: __init__() missing 1 required positional argument: 'seed'
This bug can be fixed by adding e.g. seed=None,
in https://github.com/webermarcolivier/statannot/blob/1835078a4e13d896ded8f8fc84c69dbea9393ea8/statannot/statannot.py#L438-L442.
👍