Skip to content

Commit 06bb741

Browse files
committed
forest_plot can now be accessed directly from dabest
1 parent 75929f3 commit 06bb741

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

dabest/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from ._stats_tools import confint_2group_diff as ci_2g
44
from ._effsize_objects import TwoGroupsEffectSize, PermutationTest
55
from ._dabest_object import Dabest
6+
from .forest_plot import forest_plot
67

78

89
import os

nbs/tutorials/07-forest_plot.ipynb

+36-37
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"name": "stderr",
4444
"output_type": "stream",
4545
"text": [
46-
"Compiling numba functions: 100%|██████████| 11/11 [00:03<00:00, 2.83it/s]\n"
46+
"Compiling numba functions: 100%|██████████| 11/11 [00:00<00:00, 50.19it/s]"
4747
]
4848
},
4949
{
@@ -53,13 +53,19 @@
5353
"Numba compilation complete!\n",
5454
"We're using DABEST v2025.03.14\n"
5555
]
56+
},
57+
{
58+
"name": "stderr",
59+
"output_type": "stream",
60+
"text": [
61+
"\n"
62+
]
5663
}
5764
],
5865
"source": [
5966
"import numpy as np\n",
6067
"import pandas as pd\n",
6168
"import dabest\n",
62-
"from dabest.forest_plot import forest_plot\n",
6369
"import matplotlib.pyplot as plt\n",
6470
"import dabest \n",
6571
"print(\"We're using DABEST v{}\".format(dabest.__version__))"
@@ -328,7 +334,7 @@
328334
}
329335
],
330336
"source": [
331-
"f_forest_delta2 = forest_plot(\n",
337+
"f_forest_delta2 = dabest.forest_plot(\n",
332338
" data = contrasts, \n",
333339
" labels = ['Drug1', 'Drug2', 'Drug3']\n",
334340
");"
@@ -364,7 +370,7 @@
364370
}
365371
],
366372
"source": [
367-
"f_forest_delta2 = forest_plot(\n",
373+
"f_forest_delta2 = dabest.forest_plot(\n",
368374
" data = contrasts, \n",
369375
" labels = ['Drug1 Delta1', 'Drug1 Delta-Delta', 'Drug2 Delta1', 'Drug2 Delta-Delta', 'Drug3 Delta1', 'Drug3 Delta-Delta'],\n",
370376
" idx=[[0, 2], [0, 2], [0, 2]]\n",
@@ -417,20 +423,20 @@
417423
}
418424
],
419425
"source": [
420-
"f_forest_delta2 = forest_plot(\n",
421-
" data = contrasts, \n",
422-
" labels = ['Drug1', 'Drug2', 'Drug3'],\n",
423-
" effect_size='hedges_g');\n",
424-
"f_forest_delta2 = forest_plot(\n",
425-
" data = contrasts, \n",
426-
" labels = ['Drug1', 'Drug2', 'Drug3'],\n",
427-
" effect_size='delta_g');\n",
426+
"f_forest_delta2 = dabest.forest_plot(\n",
427+
" data = contrasts, \n",
428+
" labels = ['Drug1', 'Drug2', 'Drug3'],\n",
429+
" effect_size='hedges_g');\n",
430+
"f_forest_delta2 = dabest.forest_plot(\n",
431+
" data = contrasts, \n",
432+
" labels = ['Drug1', 'Drug2', 'Drug3'],\n",
433+
" effect_size='delta_g');\n",
428434
"\n",
429-
"f_forest_delta2 = forest_plot(\n",
430-
" data = contrasts, \n",
431-
" labels = ['Drug1 Delta1', 'Drug1 Delta-Delta', 'Drug2 Delta1', 'Drug2 Delta-Delta', 'Drug3 Delta1', 'Drug3 Delta-Delta'],\n",
432-
" effect_size='hedges_g',\n",
433-
" idx=[[0, 2], [0, 2], [0, 2]]);"
435+
"f_forest_delta2 = dabest.forest_plot(\n",
436+
" data = contrasts, \n",
437+
" labels = ['Drug1 Delta1', 'Drug1 Delta-Delta', 'Drug2 Delta1', 'Drug2 Delta-Delta', 'Drug3 Delta1', 'Drug3 Delta-Delta'],\n",
438+
" effect_size='hedges_g',\n",
439+
" idx=[[0, 2], [0, 2], [0, 2]]);"
434440
]
435441
},
436442
{
@@ -551,9 +557,9 @@
551557
}
552558
],
553559
"source": [
554-
"f_forest_minimeta = forest_plot(\n",
555-
" data = contrasts_mini_meta, \n",
556-
" labels=['mini_meta1', 'mini_meta2', 'mini_meta3']\n",
560+
"f_forest_minimeta = dabest.forest_plot(\n",
561+
" data = contrasts_mini_meta, \n",
562+
" labels=['mini_meta1', 'mini_meta2', 'mini_meta3']\n",
557563
");"
558564
]
559565
},
@@ -587,20 +593,13 @@
587593
}
588594
],
589595
"source": [
590-
"f_forest_minimeta = forest_plot(\n",
596+
"f_forest_minimeta = dabest.forest_plot(\n",
591597
" data = contrasts_mini_meta, \n",
592598
" idx = [[0, 3],[0, 3], [0, 3]],\n",
593599
" labels=['Contrast 1A', 'mini_meta1', 'Contrast 2A', 'mini_meta2', 'Contrast 3A', 'mini_meta3']\n",
594600
");"
595601
]
596602
},
597-
{
598-
"cell_type": "code",
599-
"execution_count": null,
600-
"metadata": {},
601-
"outputs": [],
602-
"source": []
603-
},
604603
{
605604
"cell_type": "markdown",
606605
"metadata": {},
@@ -641,7 +640,7 @@
641640
}
642641
],
643642
"source": [
644-
"forest_plot(contrasts_deltas, idx=((0,),(0,), (0,)), \n",
643+
"dabest.forest_plot(contrasts_deltas, idx=((0,),(0,), (0,)), \n",
645644
" labels=['Drug1 \\nTest 1 - Control 1', 'Drug2 \\nTest 2 - Control 2', 'Drug3 \\nTest 3 - Control 3']);"
646645
]
647646
},
@@ -732,7 +731,7 @@
732731
}
733732
],
734733
"source": [
735-
"f_forest_minimeta = forest_plot(\n",
734+
"f_forest_minimeta = dabest.forest_plot(\n",
736735
" data = contrasts_mini_meta, \n",
737736
" labels=['mini_meta1', 'mini_meta2', 'mini_meta3'],\n",
738737
" horizontal=True,)"
@@ -763,7 +762,7 @@
763762
}
764763
],
765764
"source": [
766-
"f_forest_minimeta = forest_plot(\n",
765+
"f_forest_minimeta = dabest.forest_plot(\n",
767766
" data = contrasts_mini_meta, \n",
768767
" labels=['mini_meta1', 'mini_meta2', 'mini_meta3'],\n",
769768
" custom_palette=['#FF0000', '#00FF00', '#0000FF'],)"
@@ -794,7 +793,7 @@
794793
}
795794
],
796795
"source": [
797-
"f_forest_hedgesg = forest_plot(\n",
796+
"f_forest_hedgesg = dabest.forest_plot(\n",
798797
" data = contrasts, \n",
799798
" labels =['Drug1', 'Drug2', 'Drug3'], \n",
800799
" effect_size='hedges_g',\n",
@@ -826,7 +825,7 @@
826825
}
827826
],
828827
"source": [
829-
"f_forest_minimeta = forest_plot(\n",
828+
"f_forest_minimeta = dabest.forest_plot(\n",
830829
" data = contrasts_mini_meta, \n",
831830
" labels=['mini_meta1', 'mini_meta2', 'mini_meta3'],\n",
832831
" custom_palette=['#FF0000', '#00FF00', '#0000FF'],\n",
@@ -869,7 +868,7 @@
869868
}
870869
],
871870
"source": [
872-
"f_forest_minimeta = forest_plot(\n",
871+
"f_forest_minimeta = dabest.forest_plot(\n",
873872
" data = contrasts_mini_meta, \n",
874873
" labels=['mini_meta1', 'mini_meta2', 'mini_meta3'],\n",
875874
" custom_palette=['#FF0000', '#00FF00', '#0000FF'],\n",
@@ -906,7 +905,7 @@
906905
}
907906
],
908907
"source": [
909-
"f_forest_minimeta = forest_plot(\n",
908+
"f_forest_minimeta = dabest.forest_plot(\n",
910909
" data = contrasts_mini_meta, \n",
911910
" labels=['mini_meta1', 'mini_meta2', 'mini_meta3'],\n",
912911
" custom_palette=['#FF0000', '#00FF00', '#0000FF'],\n",
@@ -939,7 +938,7 @@
939938
}
940939
],
941940
"source": [
942-
"f_forest_minimeta = forest_plot(\n",
941+
"f_forest_minimeta = dabest.forest_plot(\n",
943942
" data = contrasts_mini_meta, \n",
944943
" labels=['mini_meta1', 'mini_meta2', 'mini_meta3'],\n",
945944
" custom_palette=['#FF0000', '#00FF00', '#0000FF'],\n",
@@ -985,7 +984,7 @@
985984
" ax = ax\n",
986985
" )\n",
987986
"\n",
988-
"forest_plot(\n",
987+
"dabest.forest_plot(\n",
989988
" data = contrasts, \n",
990989
" labels = ['Drug1', 'Drug2', 'Drug3'], \n",
991990
" ax = axes[1,1], \n",

0 commit comments

Comments
 (0)