1
1
.. _Tutorial :
2
2
.. highlight :: python
3
3
:linenothreshold: 2
4
- :dedent: 4
5
4
6
5
========
7
6
Tutorial
@@ -12,6 +11,7 @@ Load libraries
12
11
13
12
.. code-block :: ipython3
14
13
:linenos:
14
+ :dedent: 1
15
15
16
16
import os
17
17
@@ -42,6 +42,7 @@ for more details.
42
42
43
43
.. code-block :: ipython3
44
44
:linenos:
45
+ :dedent: 1
45
46
46
47
from scipy.stats import norm # Used in generation of populations.
47
48
@@ -96,6 +97,7 @@ Supply the DataFrame; supply the two groups you want to compare in the
96
97
97
98
.. code-block :: ipython3
98
99
:linenos:
100
+ :dedent: 1
99
101
100
102
fig1, results1 = dabest.plot(df, idx=('Control','Group 1'))
101
103
@@ -120,6 +122,7 @@ confidence intervals (95% by default) and relevant *P* values.
120
122
121
123
.. code-block :: ipython3
122
124
:linenos:
125
+ :dedent: 1
123
126
124
127
results1 # prints out the DataFrame returned by `dabest.plot()`.
125
128
@@ -204,6 +207,7 @@ You can color the dots with any column in the DataFrame, using the
204
207
205
208
.. code-block :: ipython3
206
209
:linenos:
210
+ :dedent: 1
207
211
208
212
f2, results2 = dabest.plot(df, idx=('Control','Group 1'),
209
213
color_col='Gender')
@@ -227,6 +231,7 @@ of repeated observations.
227
231
228
232
.. code-block :: ipython3
229
233
:linenos:
234
+ :dedent: 1
230
235
231
236
f3, results3 = dabest.plot(df, idx=('Control','Group 1'),
232
237
color_col='Gender',
@@ -243,6 +248,7 @@ be paired, as indicated by the DataFrame produced.
243
248
244
249
.. code-block :: ipython3
245
250
:linenos:
251
+ :dedent: 1
246
252
247
253
f4, results4 = dabest.plot(df, idx=('Control','Group 1'),
248
254
color_col='Gender',
@@ -314,6 +320,7 @@ be computed.
314
320
315
321
.. code-block :: ipython3
316
322
:linenos:
323
+ :dedent: 1
317
324
318
325
f5, results5 = dabest.plot(df, idx=(('Control','Group 1'),
319
326
('Group 2','Group 3'),
@@ -401,6 +408,7 @@ controlled with the ``float_contrast`` option.
401
408
402
409
.. code-block :: ipython3
403
410
:linenos:
411
+ :dedent: 1
404
412
405
413
f6, results6 = dabest.plot(df, idx=(('Control','Group 1'),
406
414
('Group 2','Group 3'),
@@ -414,6 +422,7 @@ You can also produce a paired multi-group plot, by setting `paired=True`.
414
422
415
423
.. code-block :: ipython3
416
424
:linenos:
425
+ :dedent: 1
417
426
418
427
f6_paired, results6_paired = dabest.plot(df, idx=(('Control','Group 1'),
419
428
('Group 2','Group 3'),
@@ -442,6 +451,7 @@ be computed against the first control group.
442
451
443
452
.. code-block :: ipython3
444
453
:linenos:
454
+ :dedent: 1
445
455
446
456
f7, results7 = dabest.plot(df, idx=('Control', 'Group 2', 'Group 4'),
447
457
color_col='Gender')
@@ -518,6 +528,7 @@ the function.
518
528
519
529
.. code-block :: ipython3
520
530
:linenos:
531
+ :dedent: 1
521
532
522
533
f8, results8 = dabest.plot(df, idx=('Control', 'Group 2', 'Group 4'),
523
534
color_col='Gender',
@@ -535,6 +546,7 @@ Below we run through ways of customizing various aesthetic features.
535
546
536
547
.. code-block :: ipython3
537
548
:linenos:
549
+ :dedent: 1
538
550
539
551
# Changing the contrast y-limits.
540
552
@@ -549,6 +561,7 @@ Below we run through ways of customizing various aesthetic features.
549
561
550
562
.. code-block :: ipython3
551
563
:linenos:
564
+ :dedent: 1
552
565
553
566
# Changing the swarmplot y-limits.
554
567
@@ -563,6 +576,7 @@ Below we run through ways of customizing various aesthetic features.
563
576
564
577
.. code-block :: ipython3
565
578
:linenos:
579
+ :dedent: 1
566
580
567
581
# Changing the figure size.
568
582
# The default figure size has been tweaked for
@@ -581,6 +595,7 @@ Below we run through ways of customizing various aesthetic features.
581
595
582
596
.. code-block :: ipython3
583
597
:linenos:
598
+ :dedent: 1
584
599
585
600
# Changing the size and alpha (transparency) of the dots in the swarmplot.
586
601
# This is done through swarmplot_kwargs, which accepts a dictionary.
@@ -599,6 +614,7 @@ Below we run through ways of customizing various aesthetic features.
599
614
600
615
.. code-block :: ipython3
601
616
:linenos:
617
+ :dedent: 1
602
618
603
619
# Custom y-axis labels.
604
620
f13, results13 = dabest.plot(df, idx=('Control','Group 1','Group 2'),
@@ -615,6 +631,7 @@ Below we run through ways of customizing various aesthetic features.
615
631
616
632
.. code-block :: ipython3
617
633
:linenos:
634
+ :dedent: 1
618
635
619
636
# Any of matplotlib's named colors will work.
620
637
# See https://matplotlib.org/examples/color/named_colors.html
@@ -634,6 +651,7 @@ Below we run through ways of customizing various aesthetic features.
634
651
635
652
.. code-block :: ipython3
636
653
:linenos:
654
+ :dedent: 1
637
655
638
656
# You can also pass colors in the RGB tuple form (r, g, b),
639
657
# or in hexadecimal form (if you're more familiar with HTML color codes).
@@ -652,6 +670,7 @@ Below we run through ways of customizing various aesthetic features.
652
670
653
671
.. code-block :: ipython3
654
672
:linenos:
673
+ :dedent: 1
655
674
656
675
# Passing a dict as a custom palette.
657
676
f16, results16 = dabest.plot(df, idx=('Control','Group 1','Group 2'),
@@ -667,6 +686,7 @@ Below we run through ways of customizing various aesthetic features.
667
686
668
687
.. code-block :: ipython3
669
688
:linenos:
689
+ :dedent: 1
670
690
671
691
# Tweaking the tick length and padding between tick and label.
672
692
@@ -693,6 +713,7 @@ More details on wide vs long or 'melted' data can be found in this `Wikipedia ar
693
713
694
714
.. code-block :: ipython3
695
715
:linenos:
716
+ :dedent: 1
696
717
697
718
x='group'
698
719
y='my_metric'
@@ -769,6 +790,7 @@ numerical values for plotting) columns.
769
790
770
791
.. code-block :: ipython3
771
792
:linenos:
793
+ :dedent: 1
772
794
773
795
f17, results17 = dabest.plot(df_melt,
774
796
x='group',
0 commit comments