Skip to content

Commit 3dacd32

Browse files
committed
Edit horizontal plot mini-meta and delta-delta
> reduce white space > remove empty 'control' column of gridkey > capitalise label in gridkey
1 parent 8c75b03 commit 3dacd32

34 files changed

Lines changed: 14 additions & 16 deletions

File tree

dabest/plot_tools.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,12 +1448,11 @@ def extract_curve_data(dabest_object):
14481448

14491449
if horizontal:
14501450
violinplot_kwargs.update({'vert': False, 'widths': 1})
1451-
position = max(rawdata_axes.get_yticks()) + 2
1451+
position = max(rawdata_axes.get_yticks()) + 1
14521452
half = "bottom"
14531453
effsize_x, effsize_y = difference, [position]
14541454
ci_x, ci_y = [ci_low, ci_high], [position, position]
14551455
else:
1456-
# position = max(rawdata_axes.get_xticks()) + 2
14571456
position = max(rawdata_axes.get_xticks()) + 1
14581457
half = "right"
14591458
effsize_x, effsize_y = [position], difference
@@ -1881,9 +1880,9 @@ def gridkey_plotter(
18811880
# Add delta-delta or mini_meta details to the table
18821881
if show_mini_meta or show_delta2:
18831882
if show_delta2:
1884-
added_group_name = ["deltas' g"] if effect_size == "hedges_g" else ["delta-delta"]
1883+
added_group_name = ["Deltas' g"] if effect_size == "hedges_g" else ["Delta-Delta"]
18851884
else:
1886-
added_group_name = ["Weighted delta"]
1885+
added_group_name = ["Weighted Delta"]
18871886
gridkey_rows = added_group_name + gridkey_rows
18881887
table_cellcols = [[""]*len(table_cellcols[0])] + table_cellcols
18891888

@@ -1911,7 +1910,7 @@ def gridkey_plotter(
19111910
elif horizontal or show_mini_meta:
19121911
for group_idx, group_vals in enumerate(table_cellcols):
19131912
if group_idx == 0:
1914-
added_group = [gridkey_marker] if not horizontal else [" ", gridkey_marker]
1913+
added_group = [gridkey_marker]
19151914
elif gridkey_show_es and (group_idx == len(table_cellcols)-1) and not horizontal:
19161915
added_delta_effectsize = delta_delta.difference if show_delta2 else mini_meta.difference
19171916
added_delta_effectsize_str = np.format_float_positional(
@@ -1921,9 +1920,9 @@ def gridkey_plotter(
19211920
trim="k",
19221921
min_digits=2,
19231922
)
1924-
added_group = [added_delta_effectsize_str] if not horizontal else ['', added_delta_effectsize_str]
1923+
added_group = [added_delta_effectsize_str]
19251924
else:
1926-
added_group = [''] if not horizontal else ['', '']
1925+
added_group = ['']
19271926
for n in added_group:
19281927
group_vals.append(n)
19291928

@@ -2204,7 +2203,7 @@ def table_for_horizontal_plots(
22042203

22052204
### Plot the text
22062205
if show_mini_meta or show_delta2:
2207-
new_ticks = ticks_to_plot + [max(ticks_to_plot)+2]
2206+
new_ticks = ticks_to_plot + [max(ticks_to_plot)+1]
22082207
else:
22092208
new_ticks = ticks_to_plot.copy()
22102209
for i,loc in zip(tab.index, new_ticks):

nbs/API/plot_tools.ipynb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,12 +1498,11 @@
14981498
"\n",
14991499
" if horizontal: \n",
15001500
" violinplot_kwargs.update({'vert': False, 'widths': 1})\n",
1501-
" position = max(rawdata_axes.get_yticks()) + 2\n",
1501+
" position = max(rawdata_axes.get_yticks()) + 1\n",
15021502
" half = \"bottom\"\n",
15031503
" effsize_x, effsize_y = difference, [position]\n",
15041504
" ci_x, ci_y = [ci_low, ci_high], [position, position]\n",
15051505
" else:\n",
1506-
" # position = max(rawdata_axes.get_xticks()) + 2\n",
15071506
" position = max(rawdata_axes.get_xticks()) + 1\n",
15081507
" half = \"right\"\n",
15091508
" effsize_x, effsize_y = [position], difference\n",
@@ -1931,9 +1930,9 @@
19311930
" # Add delta-delta or mini_meta details to the table\n",
19321931
" if show_mini_meta or show_delta2:\n",
19331932
" if show_delta2:\n",
1934-
" added_group_name = [\"deltas' g\"] if effect_size == \"hedges_g\" else [\"delta-delta\"]\n",
1933+
" added_group_name = [\"Deltas' g\"] if effect_size == \"hedges_g\" else [\"Delta-Delta\"]\n",
19351934
" else:\n",
1936-
" added_group_name = [\"Weighted delta\"]\n",
1935+
" added_group_name = [\"Weighted Delta\"]\n",
19371936
" gridkey_rows = added_group_name + gridkey_rows\n",
19381937
" table_cellcols = [[\"\"]*len(table_cellcols[0])] + table_cellcols\n",
19391938
"\n",
@@ -1961,7 +1960,7 @@
19611960
" elif horizontal or show_mini_meta:\n",
19621961
" for group_idx, group_vals in enumerate(table_cellcols):\n",
19631962
" if group_idx == 0:\n",
1964-
" added_group = [gridkey_marker] if not horizontal else [\" \", gridkey_marker] \n",
1963+
" added_group = [gridkey_marker]\n",
19651964
" elif gridkey_show_es and (group_idx == len(table_cellcols)-1) and not horizontal:\n",
19661965
" added_delta_effectsize = delta_delta.difference if show_delta2 else mini_meta.difference\n",
19671966
" added_delta_effectsize_str = np.format_float_positional(\n",
@@ -1971,9 +1970,9 @@
19711970
" trim=\"k\",\n",
19721971
" min_digits=2,\n",
19731972
" )\n",
1974-
" added_group = [added_delta_effectsize_str] if not horizontal else ['', added_delta_effectsize_str]\n",
1973+
" added_group = [added_delta_effectsize_str]\n",
19751974
" else:\n",
1976-
" added_group = [''] if not horizontal else ['', '']\n",
1975+
" added_group = ['']\n",
19771976
" for n in added_group:\n",
19781977
" group_vals.append(n)\n",
19791978
"\n",
@@ -2254,7 +2253,7 @@
22542253
"\n",
22552254
" ### Plot the text\n",
22562255
" if show_mini_meta or show_delta2:\n",
2257-
" new_ticks = ticks_to_plot + [max(ticks_to_plot)+2]\n",
2256+
" new_ticks = ticks_to_plot + [max(ticks_to_plot)+1]\n",
22582257
" else:\n",
22592258
" new_ticks = ticks_to_plot.copy()\n",
22602259
" for i,loc in zip(tab.index, new_ticks):\n",
-19 Bytes
Loading
-52 Bytes
Loading
-87 Bytes
Loading
-96 Bytes
Loading
-16 Bytes
Loading
-19 Bytes
Loading
300 Bytes
Loading
2.85 KB
Loading

0 commit comments

Comments
 (0)