Skip to content

Commit 794baed

Browse files
committed
Add some docstrings and remove a few redundant lines
1 parent 7c4da36 commit 794baed

7 files changed

+125
-58
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
DABEST-Python
2-
================
1+
# DABEST-Python
2+
33

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

dabest/misc_tools.py

+48-5
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ def gardner_altman_adjustments(
13551355
redraw_axes_kwargs: dict
13561356
):
13571357
"""
1358-
Aesthetic adjustments for the Gardner-Altman plot.
1358+
Aesthetic adjustments specific to Gardner-Altman plots (float_contrast=True).
13591359
13601360
Parameters
13611361
----------
@@ -1546,6 +1546,20 @@ def draw_zeroline(
15461546
reflines_kwargs : dict,
15471547
extra_delta : bool,
15481548
):
1549+
"""
1550+
Draw the independent axis spine lines.
1551+
1552+
Parameters
1553+
----------
1554+
ax : object (Axes)
1555+
The contrast data axes.
1556+
horizontal : bool
1557+
A boolean flag to determine if the plot is for horizontal plotting.
1558+
reflines_kwargs : dict
1559+
Additional keyword arguments to be passed to the zeroline.
1560+
extra_delta : bool
1561+
A boolean flag to determine if the plot includes an extra delta (delta-delta or mini-meta).
1562+
"""
15491563
# If 0 lies within the ylim of the contrast axes, draw a zero reference line.
15501564
if extra_delta and not horizontal:
15511565
contrast_xlim = [-0.5, 3.4]
@@ -1584,9 +1598,40 @@ def redraw_independent_spines(
15841598
ticks_to_skip : list,
15851599
temp_idx : list,
15861600
ticks_to_skip_contrast : list,
1587-
extra_delta : bool,
15881601
redraw_axes_kwargs : dict
15891602
):
1603+
"""
1604+
Draw the independent axis spine lines.
1605+
1606+
Parameters
1607+
----------
1608+
rawdata_axes : object (Axes)
1609+
The raw data axes.
1610+
contrast_axes : object (Axes)
1611+
The contrast axes.
1612+
horizontal : bool
1613+
A boolean flag to determine if the plot is for horizontal plotting.
1614+
two_col_sankey : bool
1615+
A boolean flag to determine if the plot is for two-col sankey.
1616+
ticks_to_start_twocol_sankey : list
1617+
A list of ticks to start for sankey plot.
1618+
idx : list
1619+
A list of indices.
1620+
is_paired : bool
1621+
A boolean flag to determine if the data is paired.
1622+
show_pairs : bool
1623+
A boolean flag to determine if pairs should be shown.
1624+
proportional : bool
1625+
A boolean flag to determine if the plot is proportional/binary.
1626+
ticks_to_skip : list,
1627+
A list of ticks to be skipped in the raw data axes.
1628+
temp_idx : list,
1629+
A temporary list of indices to be used for skipping ticks in the raw data axes.
1630+
ticks_to_skip_contrast : list,
1631+
A list of ticks to be skipped in the contrast axes.
1632+
redraw_axes_kwargs : dict
1633+
Kwargs passed to the redraw axes.
1634+
"""
15901635
# Extract the ticks
15911636
if two_col_sankey:
15921637
rightend_ticks_raw = rightend_ticks_contrast = np.array([len(i) - 2 for i in idx]) + np.array(ticks_to_start_twocol_sankey)
@@ -1655,7 +1700,7 @@ def redraw_dependent_spines(
16551700
delta2_axes: axes.Axes
16561701
):
16571702
"""
1658-
Aesthetic general adjustments across both GA and Cumming plots.
1703+
Draw the dependent axis spine lines.
16591704
16601705
Parameters
16611706
----------
@@ -1665,8 +1710,6 @@ def redraw_dependent_spines(
16651710
The contrast axes.
16661711
redraw_axes_kwargs : dict
16671712
Kwargs passed to the redraw axes.
1668-
plot_kwargs : dict
1669-
Kwargs passed to the plot function.
16701713
float_contrast : bool
16711714
A boolean flag to determine if the plot is GA or Cum
16721715
horizontal : bool

dabest/plot_tools.py

+1-11
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,6 @@ def summary_bars_plotter(
887887
ticks_to_plot: list,
888888
color_col: str,
889889
plot_palette_raw: dict,
890-
proportional: bool,
891890
show_pairs: bool,
892891
horizontal: bool
893892
):
@@ -914,8 +913,6 @@ def summary_bars_plotter(
914913
Column name of the color column.
915914
plot_palette_raw : dict
916915
Dictionary of colors used in the plot.
917-
proportional : bool
918-
Whether the data is proportional.
919916
show_pairs : bool
920917
Whether the data is paired and shown in pairs.
921918
horizontal : bool
@@ -1055,8 +1052,7 @@ def delta_text_plotter(
10551052
delta_text_kwargs: dict,
10561053
color_col: str,
10571054
plot_palette_raw: dict,
1058-
show_pairs: bool,
1059-
proportional: bool,
1055+
show_pairs: bool,
10601056
float_contrast: bool,
10611057
show_mini_meta: bool,
10621058
mini_meta: object,
@@ -1085,8 +1081,6 @@ def delta_text_plotter(
10851081
Dictionary of colors used in the plot.
10861082
show_pairs : bool
10871083
Whether the data is paired and show pairs.
1088-
proportional : bool
1089-
Whether the data is proportional.
10901084
float_contrast : bool
10911085
Whether the DABEST plot uses Gardner-Altman or Cummings
10921086
show_mini_meta : bool
@@ -2055,7 +2049,6 @@ def barplotter(
20552049
raw_colors: str,
20562050
plot_palette_raw: dict,
20572051
color_col: str,
2058-
plot_kwargs: dict,
20592052
barplot_kwargs: dict,
20602053
horizontal: bool
20612054
):
@@ -2080,8 +2073,6 @@ def barplotter(
20802073
Dictionary of colors used in the bar plot.
20812074
color_col : str
20822075
Column name of the color column.
2083-
plot_kwargs : dict
2084-
Keyword arguments for the plot.
20852076
barplot_kwargs : dict
20862077
Keyword arguments for the barplot.
20872078
horizontal : bool
@@ -2143,7 +2134,6 @@ def barplotter(
21432134
)
21442135

21452136
# adjust the width of bars
2146-
# bar_width = plot_kwargs["bar_width"]
21472137
if horizontal:
21482138
for bar in bar1.patches:
21492139
y = bar.get_y()

dabest/plotter.py

-4
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ def effectsize_df_plotter(effectsize_df: object, **plot_kwargs) -> matplotlib.fi
247247
raw_colors = raw_colors,
248248
plot_palette_raw = plot_palette_raw,
249249
color_col = color_col,
250-
plot_kwargs = plot_kwargs,
251250
barplot_kwargs = barplot_kwargs,
252251
horizontal = horizontal,
253252
)
@@ -440,7 +439,6 @@ def effectsize_df_plotter(effectsize_df: object, **plot_kwargs) -> matplotlib.fi
440439
color_col = color_col,
441440
plot_palette_raw = plot_palette_raw,
442441
show_pairs = show_pairs,
443-
proportional = proportional,
444442
float_contrast = float_contrast,
445443
show_mini_meta = show_mini_meta,
446444
mini_meta = effectsize_df.mini_meta if show_mini_meta else None,
@@ -507,7 +505,6 @@ def effectsize_df_plotter(effectsize_df: object, **plot_kwargs) -> matplotlib.fi
507505
ticks_to_skip = ticks_to_skip,
508506
temp_idx = temp_idx if is_paired == "baseline" and show_pairs else None,
509507
ticks_to_skip_contrast = ticks_to_skip_contrast,
510-
extra_delta = True if (show_delta2 or show_mini_meta) else False,
511508
redraw_axes_kwargs = redraw_axes_kwargs
512509
)
513510

@@ -587,7 +584,6 @@ def effectsize_df_plotter(effectsize_df: object, **plot_kwargs) -> matplotlib.fi
587584
ticks_to_plot = ticks_to_plot,
588585
color_col = color_col,
589586
plot_palette_raw = plot_palette_raw,
590-
proportional = proportional,
591587
show_pairs = show_pairs,
592588
horizontal = horizontal,
593589
)

nbs/API/misc_tools.ipynb

+48-5
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@
14091409
" redraw_axes_kwargs: dict\n",
14101410
" ):\n",
14111411
" \"\"\"\n",
1412-
" Aesthetic adjustments for the Gardner-Altman plot.\n",
1412+
" Aesthetic adjustments specific to Gardner-Altman plots (float_contrast=True).\n",
14131413
" \n",
14141414
" Parameters\n",
14151415
" ----------\n",
@@ -1600,6 +1600,20 @@
16001600
" reflines_kwargs : dict,\n",
16011601
" extra_delta : bool,\n",
16021602
" ):\n",
1603+
" \"\"\"\n",
1604+
" Draw the independent axis spine lines.\n",
1605+
"\n",
1606+
" Parameters\n",
1607+
" ----------\n",
1608+
" ax : object (Axes)\n",
1609+
" The contrast data axes.\n",
1610+
" horizontal : bool\n",
1611+
" A boolean flag to determine if the plot is for horizontal plotting.\n",
1612+
" reflines_kwargs : dict\n",
1613+
" Additional keyword arguments to be passed to the zeroline.\n",
1614+
" extra_delta : bool\n",
1615+
" A boolean flag to determine if the plot includes an extra delta (delta-delta or mini-meta).\n",
1616+
" \"\"\"\n",
16031617
" # If 0 lies within the ylim of the contrast axes, draw a zero reference line.\n",
16041618
" if extra_delta and not horizontal:\n",
16051619
" contrast_xlim = [-0.5, 3.4]\n",
@@ -1638,9 +1652,40 @@
16381652
" ticks_to_skip : list,\n",
16391653
" temp_idx : list,\n",
16401654
" ticks_to_skip_contrast : list,\n",
1641-
" extra_delta : bool,\n",
16421655
" redraw_axes_kwargs : dict\n",
16431656
" ):\n",
1657+
" \"\"\"\n",
1658+
" Draw the independent axis spine lines.\n",
1659+
"\n",
1660+
" Parameters\n",
1661+
" ----------\n",
1662+
" rawdata_axes : object (Axes)\n",
1663+
" The raw data axes.\n",
1664+
" contrast_axes : object (Axes)\n",
1665+
" The contrast axes.\n",
1666+
" horizontal : bool\n",
1667+
" A boolean flag to determine if the plot is for horizontal plotting.\n",
1668+
" two_col_sankey : bool\n",
1669+
" A boolean flag to determine if the plot is for two-col sankey.\n",
1670+
" ticks_to_start_twocol_sankey : list\n",
1671+
" A list of ticks to start for sankey plot.\n",
1672+
" idx : list\n",
1673+
" A list of indices.\n",
1674+
" is_paired : bool\n",
1675+
" A boolean flag to determine if the data is paired.\n",
1676+
" show_pairs : bool\n",
1677+
" A boolean flag to determine if pairs should be shown.\n",
1678+
" proportional : bool\n",
1679+
" A boolean flag to determine if the plot is proportional/binary.\n",
1680+
" ticks_to_skip : list,\n",
1681+
" A list of ticks to be skipped in the raw data axes.\n",
1682+
" temp_idx : list,\n",
1683+
" A temporary list of indices to be used for skipping ticks in the raw data axes.\n",
1684+
" ticks_to_skip_contrast : list,\n",
1685+
" A list of ticks to be skipped in the contrast axes.\n",
1686+
" redraw_axes_kwargs : dict\n",
1687+
" Kwargs passed to the redraw axes.\n",
1688+
" \"\"\"\n",
16441689
" # Extract the ticks\n",
16451690
" if two_col_sankey:\n",
16461691
" rightend_ticks_raw = rightend_ticks_contrast = np.array([len(i) - 2 for i in idx]) + np.array(ticks_to_start_twocol_sankey)\n",
@@ -1709,7 +1754,7 @@
17091754
" delta2_axes: axes.Axes\n",
17101755
" ):\n",
17111756
" \"\"\"\n",
1712-
" Aesthetic general adjustments across both GA and Cumming plots.\n",
1757+
" Draw the dependent axis spine lines.\n",
17131758
"\n",
17141759
" Parameters\n",
17151760
" ----------\n",
@@ -1719,8 +1764,6 @@
17191764
" The contrast axes.\n",
17201765
" redraw_axes_kwargs : dict\n",
17211766
" Kwargs passed to the redraw axes.\n",
1722-
" plot_kwargs : dict\n",
1723-
" Kwargs passed to the plot function.\n",
17241767
" float_contrast : bool\n",
17251768
" A boolean flag to determine if the plot is GA or Cum\n",
17261769
" horizontal : bool\n",

nbs/API/plot_tools.ipynb

+1-11
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,6 @@
937937
" ticks_to_plot: list, \n",
938938
" color_col: str, \n",
939939
" plot_palette_raw: dict, \n",
940-
" proportional: bool, \n",
941940
" show_pairs: bool, \n",
942941
" horizontal: bool\n",
943942
" ):\n",
@@ -964,8 +963,6 @@
964963
" Column name of the color column.\n",
965964
" plot_palette_raw : dict\n",
966965
" Dictionary of colors used in the plot.\n",
967-
" proportional : bool\n",
968-
" Whether the data is proportional.\n",
969966
" show_pairs : bool\n",
970967
" Whether the data is paired and shown in pairs.\n",
971968
" horizontal : bool\n",
@@ -1105,8 +1102,7 @@
11051102
" delta_text_kwargs: dict, \n",
11061103
" color_col: str, \n",
11071104
" plot_palette_raw: dict, \n",
1108-
" show_pairs: bool, \n",
1109-
" proportional: bool, \n",
1105+
" show_pairs: bool,\n",
11101106
" float_contrast: bool,\n",
11111107
" show_mini_meta: bool, \n",
11121108
" mini_meta: object, \n",
@@ -1135,8 +1131,6 @@
11351131
" Dictionary of colors used in the plot.\n",
11361132
" show_pairs : bool\n",
11371133
" Whether the data is paired and show pairs.\n",
1138-
" proportional : bool\n",
1139-
" Whether the data is proportional.\n",
11401134
" float_contrast : bool\n",
11411135
" Whether the DABEST plot uses Gardner-Altman or Cummings\n",
11421136
" show_mini_meta : bool\n",
@@ -2105,7 +2099,6 @@
21052099
" raw_colors: str, \n",
21062100
" plot_palette_raw: dict, \n",
21072101
" color_col: str,\n",
2108-
" plot_kwargs: dict, \n",
21092102
" barplot_kwargs: dict, \n",
21102103
" horizontal: bool\n",
21112104
" ):\n",
@@ -2130,8 +2123,6 @@
21302123
" Dictionary of colors used in the bar plot.\n",
21312124
" color_col : str\n",
21322125
" Column name of the color column.\n",
2133-
" plot_kwargs : dict\n",
2134-
" Keyword arguments for the plot.\n",
21352126
" barplot_kwargs : dict\n",
21362127
" Keyword arguments for the barplot.\n",
21372128
" horizontal : bool\n",
@@ -2193,7 +2184,6 @@
21932184
" )\n",
21942185
"\n",
21952186
" # adjust the width of bars\n",
2196-
" # bar_width = plot_kwargs[\"bar_width\"]\n",
21972187
" if horizontal:\n",
21982188
" for bar in bar1.patches:\n",
21992189
" y = bar.get_y()\n",

0 commit comments

Comments
 (0)