-
Notifications
You must be signed in to change notification settings - Fork 74
Possibility to not use pandas dataframes? #78
Comments
Thank you for reporting this. Here is how you can use This indeed fails ax = sns.boxplot(data=[[1, 2, 3], [2, 5, 7]])
statannot.add_stat_annotation(ax, data=[[1, 2, 3], [2, 5, 7]], test="t-test_ind") as well as ax = sns.boxplot(x=[0, 0, 0, 1, 1, 1], y=[1, 2, 3, 2, 5, 7])
statannot.add_stat_annotation(ax, x=[1, 1, 1, 2, 2, 2], y=[1, 2, 3, 2, 5, 7], test="t-test_ind",
box_pairs=[(0, 1)]) because it is equivalent. ax = sns.boxplot(x=[1, 1, 1, 2, 2, 2], y=[1, 2, 3, 2, 5, 7])
statannot.add_stat_annotation(ax, x=[1, 1, 1, 2, 2, 2], y=[1, 2, 3, 2, 5, 7], test="t-test_ind",
box_pairs=[(1, 2)]) When using data without specifying So, if you can, concatenate your lists to make # Considering defined strings labels label1, label2, label3
x = [label1] * len(list_1) + [label2] * len(list2)+ [label3] * len(list3)
y = list1 + list2 + list3 (Or use Let us know how it goes! |
If you wish, you can also modify |
Oh, I just found this was proposed already in #73 which covers your bug. |
Already covered in trevismd/statannotations. |
First of all, thank you for the very nice package.
I use lists as input for all my boxplots, and I don't and don't want to use pandas. This is fine in seaborn, but I cannot get this to work with this package. At least, I think this is the problem. If I use:
ax = sns.boxplot(data=dat) results = add_stat_annotation(ax, data=dat, test='t-test_ind', text_format='star')
, where dat is a list containing three lists of equal length, which then are the three 'boxes'. The seaborn boxplot works perfectly but with add stat annotation I get the following error:
in get_box_data cat = box_plotter.plot_hues is None and boxName or boxName[0] TypeError: 'int' object is not subscriptable
So my guess is this has to do with the absence of box names but I am not sure. Is there a proper way to use your package without using pandas?
The text was updated successfully, but these errors were encountered: