Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gridkey_rows added parser #149

Open
wants to merge 2 commits into
base: vnbdev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
DABEST-Python
================
# DABEST-Python

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

Expand Down
6 changes: 5 additions & 1 deletion dabest/_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2505,6 +2505,7 @@ def plot(self, color_col=None,
contrast_show_deltas = True,

gridkey_rows=None,
gridkey_delimiters=[';', '>', '_'],
gridkey_merge_pairs = False,
gridkey_show_Ns = True,
gridkey_show_es = True,
Expand Down Expand Up @@ -2605,7 +2606,10 @@ def plot(self, color_col=None,
gridkey_rows : list, default None
Provide a list of row labels for the gridkey. The supplied idx is
checked against the row labels to determine whether the corresponding
cell should be populated or not.
cell should be populated or not. When set to 'auto', detects items in idx
and automatically generates a list of gridkey rows.
gridkey_delimiters : list, default [';', '>', '_'].
The delimiters to use for breaking up strings in idx into individual components.
swarmplot_kwargs : dict, default None
Pass any keyword arguments accepted by the seaborn `swarmplot`
command here, as a dict. If None, the following keywords are
Expand Down
21 changes: 19 additions & 2 deletions dabest/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
dpi=100,
ax=None,
gridkey_rows=None,
gridkey_delimiters=[';', '>', '_'],
swarmplot_kwargs=None,
violinplot_kwargs=None,
slopegraph_kwargs=None,
Expand Down Expand Up @@ -85,10 +86,13 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
mini_meta = EffectSizeDataFrame.mini_meta
effect_size = EffectSizeDataFrame.effect_size
proportional = EffectSizeDataFrame.proportional


all_plot_groups = dabest_obj._all_plot_groups
idx = dabest_obj.idx

x1_level = dabest_obj.x1_level
experiment_label= dabest_obj.experiment_label

if effect_size not in ["mean_diff", "delta_g"] or not delta2:
show_delta2 = False
else:
Expand Down Expand Up @@ -193,6 +197,19 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
################################################### GRIDKEY WIP - extracting arguments

gridkey_rows = plot_kwargs["gridkey_rows"]
gridkey_delimiters = plot_kwargs["gridkey_delimiters"]
if gridkey_rows == "auto":
if experiment_label is not None:
gridkey_rows = list(np.concatenate([experiment_label, x1_level]))
else:
temp_groups = ";".join(all_plot_groups)
for delimiter in gridkey_delimiters:
temp_groups = temp_groups.replace(delimiter, ";")
temp_groups = [i.strip() for i in temp_groups.split(';')]
unique_groups = list(set(temp_groups))
rank = [sum([temp_groups.index(i) for i in temp_groups if(j in i)]) for j in unique_groups]
gridkey_rows = [x for _,x in sorted(zip(rank,unique_groups))]

gridkey_merge_pairs = plot_kwargs["gridkey_merge_pairs"]
gridkey_show_Ns = plot_kwargs["gridkey_show_Ns"]
gridkey_show_es = plot_kwargs["gridkey_show_es"]
Expand Down Expand Up @@ -1296,7 +1313,7 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
groups_for_gridkey.append(i[1])
else:
groups_for_gridkey = all_plot_groups
print(all_plot_groups)

# raise errors if gridkey_rows is not a list, or if the list is empty
if isinstance(gridkey_rows, list) is False:
Expand Down
37 changes: 5 additions & 32 deletions nbs/API/class.ipynb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "ed122c74",
"metadata": {},
Expand Down Expand Up @@ -757,7 +756,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "c86c0487",
"metadata": {},
Expand Down Expand Up @@ -806,7 +804,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "cf5ca0a0",
"metadata": {},
Expand All @@ -820,7 +817,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "8b3b146c",
"metadata": {},
Expand Down Expand Up @@ -879,7 +875,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "838b2978",
"metadata": {},
Expand Down Expand Up @@ -909,7 +904,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "a5324d21",
"metadata": {},
Expand Down Expand Up @@ -958,7 +952,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "6f66579c",
"metadata": {},
Expand Down Expand Up @@ -1003,7 +996,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "40f4eff9",
"metadata": {},
Expand Down Expand Up @@ -1052,7 +1044,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "9e3e57bd",
"metadata": {},
Expand All @@ -1078,7 +1069,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "970fb3b2",
"metadata": {},
Expand Down Expand Up @@ -1127,7 +1117,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "66c8a83a",
"metadata": {},
Expand All @@ -1152,7 +1141,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "b1cf0080",
"metadata": {},
Expand Down Expand Up @@ -1201,7 +1189,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "9661ab37",
"metadata": {},
Expand All @@ -1223,7 +1210,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "bd341f7c",
"metadata": {},
Expand Down Expand Up @@ -1298,7 +1284,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "8d41dad3",
"metadata": {},
Expand Down Expand Up @@ -1711,7 +1696,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "c6a7192f",
"metadata": {},
Expand All @@ -1727,7 +1711,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "a5905b79",
"metadata": {},
Expand Down Expand Up @@ -2259,7 +2242,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "ae5bac56",
"metadata": {},
Expand All @@ -2281,7 +2263,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "dc1239ee",
"metadata": {},
Expand Down Expand Up @@ -2334,7 +2315,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "669285cb",
"metadata": {},
Expand Down Expand Up @@ -3044,7 +3024,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "d72ccb04",
"metadata": {},
Expand Down Expand Up @@ -3444,6 +3423,7 @@
" contrast_show_deltas = True,\n",
" \n",
" gridkey_rows=None,\n",
" gridkey_delimiters=[';', '>', '_'],\n",
" gridkey_merge_pairs = False,\n",
" gridkey_show_Ns = True,\n",
" gridkey_show_es = True,\n",
Expand Down Expand Up @@ -3544,7 +3524,10 @@
" gridkey_rows : list, default None\n",
" Provide a list of row labels for the gridkey. The supplied idx is\n",
" checked against the row labels to determine whether the corresponding\n",
" cell should be populated or not.\n",
" cell should be populated or not. When set to 'auto', detects items in idx\n",
" and automatically generates a list of gridkey rows.\n",
" gridkey_delimiters : list, default [';', '>', '_']. \n",
" The delimiters to use for breaking up strings in idx into individual components.\n",
" swarmplot_kwargs : dict, default None\n",
" Pass any keyword arguments accepted by the seaborn `swarmplot`\n",
" command here, as a dict. If None, the following keywords are\n",
Expand Down Expand Up @@ -3809,7 +3792,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "0e1b8353",
"metadata": {},
Expand Down Expand Up @@ -3883,7 +3865,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "a37d4519",
"metadata": {},
Expand All @@ -3902,7 +3883,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "f40f8fe0",
"metadata": {},
Expand All @@ -3921,7 +3901,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "1ee59074",
"metadata": {},
Expand All @@ -3942,7 +3921,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "3c37066a",
"metadata": {},
Expand All @@ -3964,7 +3942,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "de81e2e4",
"metadata": {},
Expand All @@ -3986,7 +3963,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "c80ba34f",
"metadata": {},
Expand All @@ -4008,7 +3984,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "4eaf4362",
"metadata": {},
Expand Down Expand Up @@ -4178,7 +4153,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "3214e42a",
"metadata": {},
Expand All @@ -4199,7 +4173,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "cc181ae2",
"metadata": {},
Expand Down
Loading
Loading