AutoStatLib 0.2.13__tar.gz → 0.2.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of AutoStatLib might be problematic. Click here for more details.
- {autostatlib-0.2.13/src/AutoStatLib.egg-info → autostatlib-0.2.16}/PKG-INFO +21 -20
- {autostatlib-0.2.13 → autostatlib-0.2.16}/README.md +19 -19
- {autostatlib-0.2.13 → autostatlib-0.2.16}/requirements.txt +1 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/src/AutoStatLib/StatPlots.py +155 -54
- {autostatlib-0.2.13 → autostatlib-0.2.16}/src/AutoStatLib/_version.py +1 -1
- {autostatlib-0.2.13 → autostatlib-0.2.16/src/AutoStatLib.egg-info}/PKG-INFO +21 -20
- {autostatlib-0.2.13 → autostatlib-0.2.16}/src/AutoStatLib.egg-info/requires.txt +1 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/LICENSE +0 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/MANIFEST.in +0 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/pyproject.toml +0 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/setup.cfg +0 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/src/AutoStatLib/AutoStatLib.py +0 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/src/AutoStatLib/__init__.py +0 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/src/AutoStatLib/__main__.py +0 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/src/AutoStatLib/helpers.py +0 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/src/AutoStatLib/normality_tests.py +0 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/src/AutoStatLib/statistical_tests.py +0 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/src/AutoStatLib/text_formatting.py +0 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/src/AutoStatLib.egg-info/SOURCES.txt +0 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/src/AutoStatLib.egg-info/dependency_links.txt +0 -0
- {autostatlib-0.2.13 → autostatlib-0.2.16}/src/AutoStatLib.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AutoStatLib
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.16
|
|
4
4
|
Summary: AutoStatLib - a simple statistical analysis tool
|
|
5
5
|
Author: Stemonitis, SciWare LLC
|
|
6
6
|
Author-email: konung-yaropolk <yaropolk1995@gmail.com>
|
|
@@ -533,6 +533,7 @@ Requires-Dist: numpy
|
|
|
533
533
|
Requires-Dist: scipy
|
|
534
534
|
Requires-Dist: statsmodels
|
|
535
535
|
Requires-Dist: matplotlib
|
|
536
|
+
Requires-Dist: seaborn
|
|
536
537
|
Requires-Dist: scikit-posthocs
|
|
537
538
|
Requires-Dist: pandas
|
|
538
539
|
Dynamic: license-file
|
|
@@ -675,22 +676,22 @@ If errors occured, *GetResult()* returns an empty dictionary
|
|
|
675
676
|
-- add QQ plot
|
|
676
677
|
-- n-sample tests: add onetail option
|
|
677
678
|
|
|
678
|
-
✅ done -- detailed normality test results
|
|
679
|
-
✅ done -- added posthoc: Kruskal-Wallis Dunn's multiple comparisons
|
|
680
|
-
|
|
681
|
-
tests check:
|
|
682
|
-
1-sample:
|
|
683
|
-
--Wilcoxon 2,1 tails - ✅ok
|
|
684
|
-
--t-tests 2,1 tails -✅ok
|
|
685
|
-
|
|
686
|
-
2-sample:
|
|
687
|
-
--Wilcoxon 2,1 tails - ✅ok
|
|
688
|
-
--Mann-whitney 2,1 tails - ✅ok
|
|
689
|
-
--t-tests 2,1 tails -✅ok
|
|
690
|
-
|
|
691
|
-
n-sample:
|
|
692
|
-
--Kruskal-Wallis 2 tail - ✅ok
|
|
693
|
-
--Dunn's multiple comparisons - ✅ok
|
|
694
|
-
--Friedman 2 tail - ✅ok
|
|
695
|
-
--one-way ANOWA 2 tail - ✅ok
|
|
696
|
-
--Tukey`s multiple comparisons - ✅ok
|
|
679
|
+
✅ done -- detailed normality test results
|
|
680
|
+
✅ done -- added posthoc: Kruskal-Wallis Dunn's multiple comparisons
|
|
681
|
+
|
|
682
|
+
tests check:
|
|
683
|
+
1-sample:
|
|
684
|
+
--Wilcoxon 2,1 tails - ✅ok
|
|
685
|
+
--t-tests 2,1 tails -✅ok
|
|
686
|
+
|
|
687
|
+
2-sample:
|
|
688
|
+
--Wilcoxon 2,1 tails - ✅ok
|
|
689
|
+
--Mann-whitney 2,1 tails - ✅ok
|
|
690
|
+
--t-tests 2,1 tails -✅ok
|
|
691
|
+
|
|
692
|
+
n-sample:
|
|
693
|
+
--Kruskal-Wallis 2 tail - ✅ok
|
|
694
|
+
--Dunn's multiple comparisons - ✅ok
|
|
695
|
+
--Friedman 2 tail - ✅ok
|
|
696
|
+
--one-way ANOWA 2 tail - ✅ok
|
|
697
|
+
--Tukey`s multiple comparisons - ✅ok
|
|
@@ -136,22 +136,22 @@ If errors occured, *GetResult()* returns an empty dictionary
|
|
|
136
136
|
-- add QQ plot
|
|
137
137
|
-- n-sample tests: add onetail option
|
|
138
138
|
|
|
139
|
-
✅ done -- detailed normality test results
|
|
140
|
-
✅ done -- added posthoc: Kruskal-Wallis Dunn's multiple comparisons
|
|
141
|
-
|
|
142
|
-
tests check:
|
|
143
|
-
1-sample:
|
|
144
|
-
--Wilcoxon 2,1 tails - ✅ok
|
|
145
|
-
--t-tests 2,1 tails -✅ok
|
|
146
|
-
|
|
147
|
-
2-sample:
|
|
148
|
-
--Wilcoxon 2,1 tails - ✅ok
|
|
149
|
-
--Mann-whitney 2,1 tails - ✅ok
|
|
150
|
-
--t-tests 2,1 tails -✅ok
|
|
151
|
-
|
|
152
|
-
n-sample:
|
|
153
|
-
--Kruskal-Wallis 2 tail - ✅ok
|
|
154
|
-
--Dunn's multiple comparisons - ✅ok
|
|
155
|
-
--Friedman 2 tail - ✅ok
|
|
156
|
-
--one-way ANOWA 2 tail - ✅ok
|
|
157
|
-
--Tukey`s multiple comparisons - ✅ok
|
|
139
|
+
✅ done -- detailed normality test results
|
|
140
|
+
✅ done -- added posthoc: Kruskal-Wallis Dunn's multiple comparisons
|
|
141
|
+
|
|
142
|
+
tests check:
|
|
143
|
+
1-sample:
|
|
144
|
+
--Wilcoxon 2,1 tails - ✅ok
|
|
145
|
+
--t-tests 2,1 tails -✅ok
|
|
146
|
+
|
|
147
|
+
2-sample:
|
|
148
|
+
--Wilcoxon 2,1 tails - ✅ok
|
|
149
|
+
--Mann-whitney 2,1 tails - ✅ok
|
|
150
|
+
--t-tests 2,1 tails -✅ok
|
|
151
|
+
|
|
152
|
+
n-sample:
|
|
153
|
+
--Kruskal-Wallis 2 tail - ✅ok
|
|
154
|
+
--Dunn's multiple comparisons - ✅ok
|
|
155
|
+
--Friedman 2 tail - ✅ok
|
|
156
|
+
--one-way ANOWA 2 tail - ✅ok
|
|
157
|
+
--Tukey`s multiple comparisons - ✅ok
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import seaborn as sns
|
|
1
2
|
import random
|
|
2
3
|
# from math import comb
|
|
3
4
|
import numpy as np
|
|
@@ -87,6 +88,9 @@ class BaseStatPlot(Helpers):
|
|
|
87
88
|
colormap=None,
|
|
88
89
|
print_p_label=True,
|
|
89
90
|
print_stars=True,
|
|
91
|
+
figure_scale_factor=1,
|
|
92
|
+
figure_h=4,
|
|
93
|
+
figure_w=0, # 0 means auto
|
|
90
94
|
**kwargs):
|
|
91
95
|
self.data_groups = [group if group else [0, 0, 0, 0]
|
|
92
96
|
for group in data_groups]
|
|
@@ -103,6 +107,9 @@ class BaseStatPlot(Helpers):
|
|
|
103
107
|
self.print_p_label = print_p_label
|
|
104
108
|
self.print_stars = print_stars
|
|
105
109
|
self.print_x_labels = print_x_labels
|
|
110
|
+
self.figure_scale_factor = figure_scale_factor
|
|
111
|
+
self.figure_h = figure_h
|
|
112
|
+
self.figure_w = figure_w
|
|
106
113
|
|
|
107
114
|
# sd sem mean and median calculation if they are not provided
|
|
108
115
|
self.mean = [
|
|
@@ -132,31 +139,16 @@ class BaseStatPlot(Helpers):
|
|
|
132
139
|
self.y_max = max([max(data) for data in self.data_groups])
|
|
133
140
|
|
|
134
141
|
def setup_figure(self, ):
|
|
135
|
-
fig, ax = plt.subplots(
|
|
136
|
-
|
|
142
|
+
fig, ax = plt.subplots(
|
|
143
|
+
dpi=100,
|
|
144
|
+
figsize=((0.5 + 0.9 * self.n_groups)
|
|
145
|
+
if not self.figure_w else self.figure_w, self.figure_h)
|
|
146
|
+
)
|
|
137
147
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
alpha=0.5,
|
|
141
|
-
marker='o',
|
|
142
|
-
linewidth=1,
|
|
143
|
-
zorder=1):
|
|
144
|
-
# Generate x jitter pool.
|
|
145
|
-
spread_pool = [] # storing x positions of data points
|
|
146
|
-
for i, data in enumerate(self.data_groups):
|
|
147
|
-
spread = tuple(random.uniform(-.10, .10) for _ in data)
|
|
148
|
-
spread_pool.append(tuple(i + s for s in spread))
|
|
148
|
+
figure_size = plt.gcf().get_size_inches()
|
|
149
|
+
plt.gcf().set_size_inches(self.figure_scale_factor * figure_size)
|
|
149
150
|
|
|
150
|
-
|
|
151
|
-
# Plot individual data points with x jitter.
|
|
152
|
-
ax.plot(self.transpose(spread_pool)[i], data,
|
|
153
|
-
color=color,
|
|
154
|
-
alpha=alpha,
|
|
155
|
-
marker=marker,
|
|
156
|
-
linewidth=linewidth,
|
|
157
|
-
# Connect the data points if desired.
|
|
158
|
-
linestyle='-' if self.dependent else '',
|
|
159
|
-
zorder=zorder)
|
|
151
|
+
return fig, ax
|
|
160
152
|
|
|
161
153
|
def add_barplot(self, ax, x,
|
|
162
154
|
fill=True,
|
|
@@ -169,7 +161,7 @@ class BaseStatPlot(Helpers):
|
|
|
169
161
|
facecolor=self.colors_fill[x % len(self.colors_fill)],
|
|
170
162
|
edgecolor=self.colors_edge[x % len(self.colors_edge)],
|
|
171
163
|
fill=fill,
|
|
172
|
-
linewidth=linewidth,
|
|
164
|
+
linewidth=linewidth*self.figure_scale_factor,
|
|
173
165
|
zorder=zorder)
|
|
174
166
|
|
|
175
167
|
def add_violinplot(self, ax, x,
|
|
@@ -189,7 +181,7 @@ class BaseStatPlot(Helpers):
|
|
|
189
181
|
for pc in vp['bodies']:
|
|
190
182
|
pc.set_facecolor(self.colors_fill[x % len(self.colors_fill)])
|
|
191
183
|
pc.set_edgecolor(self.colors_edge[x % len(self.colors_edge)])
|
|
192
|
-
pc.set_linewidth(linewidth)
|
|
184
|
+
pc.set_linewidth(linewidth*self.figure_scale_factor)
|
|
193
185
|
|
|
194
186
|
def add_boxplot(self, ax,
|
|
195
187
|
# positions of boxes, defaults to range(1,n+1)
|
|
@@ -343,6 +335,83 @@ class BaseStatPlot(Helpers):
|
|
|
343
335
|
patch.set_facecolor(
|
|
344
336
|
self.colors_fill[x % len(self.colors_fill)])
|
|
345
337
|
|
|
338
|
+
def add_scatter(self, ax,
|
|
339
|
+
color='k',
|
|
340
|
+
alpha=0.5,
|
|
341
|
+
marker='o',
|
|
342
|
+
markersize=8,
|
|
343
|
+
linewidth=1.2,
|
|
344
|
+
zorder=1):
|
|
345
|
+
# Generate x jitter pool.
|
|
346
|
+
spread_pool = [] # storing x positions of data points
|
|
347
|
+
for i, data in enumerate(self.data_groups):
|
|
348
|
+
spread = tuple(random.uniform(-.10, .10) for _ in data)
|
|
349
|
+
spread_pool.append(tuple(i + s for s in spread))
|
|
350
|
+
|
|
351
|
+
for i, data in enumerate(self.transpose(self.data_groups)):
|
|
352
|
+
# Plot individual data points with x jitter.
|
|
353
|
+
ax.plot(self.transpose(spread_pool)[i], data,
|
|
354
|
+
color=color,
|
|
355
|
+
alpha=alpha,
|
|
356
|
+
marker=marker,
|
|
357
|
+
markersize=markersize*self.figure_scale_factor,
|
|
358
|
+
linewidth=linewidth*self.figure_scale_factor,
|
|
359
|
+
# Connect the data points if desired.
|
|
360
|
+
linestyle='-' if self.dependent else '',
|
|
361
|
+
zorder=zorder)
|
|
362
|
+
|
|
363
|
+
def add_swarm(self, ax,
|
|
364
|
+
color='grey',
|
|
365
|
+
alpha=1,
|
|
366
|
+
marker='o',
|
|
367
|
+
markersize=8,
|
|
368
|
+
linewidth=1.4,
|
|
369
|
+
zorder=1):
|
|
370
|
+
"""
|
|
371
|
+
Add a swarmplot (scatter-like plot with non-overlapping points)
|
|
372
|
+
to the provided Axes. Automatically reduce point size if overcrowded.
|
|
373
|
+
"""
|
|
374
|
+
|
|
375
|
+
# Prepare flattened data
|
|
376
|
+
values = [v for i, group in enumerate(self.data_groups) for v in group]
|
|
377
|
+
groups = [i for i, group in enumerate(self.data_groups) for _ in group]
|
|
378
|
+
|
|
379
|
+
# Estimate overcrowding for adaptive sizing
|
|
380
|
+
group_counts = [len(g) for g in self.data_groups]
|
|
381
|
+
max_points = max(group_counts) if group_counts else 1
|
|
382
|
+
|
|
383
|
+
# Determine horizontal space per category
|
|
384
|
+
num_groups = len(self.data_groups)
|
|
385
|
+
xlim = ax.get_xlim()
|
|
386
|
+
width_per_group = (xlim[1] - xlim[0]) / max(num_groups, 1)
|
|
387
|
+
|
|
388
|
+
# Empirical density threshold: if points are too dense, shrink
|
|
389
|
+
density = max_points / (width_per_group + 1e-6)
|
|
390
|
+
|
|
391
|
+
# Tunable constants to approximate best function of size adjustment
|
|
392
|
+
size_scale = max(0.1, min(1, 3.5 / (density ** 0.5)))
|
|
393
|
+
|
|
394
|
+
sns.swarmplot(
|
|
395
|
+
x=groups,
|
|
396
|
+
y=values,
|
|
397
|
+
ax=ax,
|
|
398
|
+
color=color,
|
|
399
|
+
alpha=alpha,
|
|
400
|
+
size=markersize * self.figure_scale_factor * size_scale,
|
|
401
|
+
marker=marker,
|
|
402
|
+
linewidth=linewidth * self.figure_scale_factor * size_scale,
|
|
403
|
+
zorder=zorder,
|
|
404
|
+
)
|
|
405
|
+
|
|
406
|
+
# Connect points if data paired
|
|
407
|
+
if self.dependent == True:
|
|
408
|
+
for i, data in enumerate(self.transpose(self.data_groups)):
|
|
409
|
+
ax.plot(range(len(data)), data,
|
|
410
|
+
color=color,
|
|
411
|
+
alpha=alpha * 0.7,
|
|
412
|
+
linewidth=linewidth * self.figure_scale_factor,
|
|
413
|
+
zorder=zorder - 1)
|
|
414
|
+
|
|
346
415
|
def add_errorbar_sd(self, ax, x,
|
|
347
416
|
capsize=8,
|
|
348
417
|
ecolor='r',
|
|
@@ -352,9 +421,9 @@ class BaseStatPlot(Helpers):
|
|
|
352
421
|
ax.errorbar(x, self.mean[x],
|
|
353
422
|
yerr=self.sd[x],
|
|
354
423
|
fmt='none',
|
|
355
|
-
capsize=capsize,
|
|
424
|
+
capsize=capsize*self.figure_scale_factor,
|
|
356
425
|
ecolor=ecolor,
|
|
357
|
-
linewidth=linewidth,
|
|
426
|
+
linewidth=linewidth*self.figure_scale_factor,
|
|
358
427
|
zorder=zorder)
|
|
359
428
|
|
|
360
429
|
def add_errorbar_sem(self, ax, x,
|
|
@@ -366,9 +435,10 @@ class BaseStatPlot(Helpers):
|
|
|
366
435
|
ax.errorbar(x, self.mean[x],
|
|
367
436
|
yerr=self.sem[x],
|
|
368
437
|
fmt='none',
|
|
369
|
-
capsize=capsize,
|
|
438
|
+
capsize=capsize*self.figure_scale_factor,
|
|
370
439
|
ecolor=ecolor,
|
|
371
|
-
linewidth=linewidth,
|
|
440
|
+
linewidth=linewidth*self.figure_scale_factor,
|
|
441
|
+
elinewidth=linewidth*self.figure_scale_factor,
|
|
372
442
|
zorder=zorder)
|
|
373
443
|
|
|
374
444
|
def add_mean_marker(self, ax, x,
|
|
@@ -382,8 +452,8 @@ class BaseStatPlot(Helpers):
|
|
|
382
452
|
marker=marker,
|
|
383
453
|
markerfacecolor=markerfacecolor,
|
|
384
454
|
markeredgecolor=markeredgecolor,
|
|
385
|
-
markersize=markersize,
|
|
386
|
-
markeredgewidth=markeredgewidth)
|
|
455
|
+
markersize=markersize*self.figure_scale_factor,
|
|
456
|
+
markeredgewidth=markeredgewidth*self.figure_scale_factor)
|
|
387
457
|
|
|
388
458
|
def add_median_marker(self, ax, x,
|
|
389
459
|
marker='x',
|
|
@@ -396,8 +466,8 @@ class BaseStatPlot(Helpers):
|
|
|
396
466
|
marker=marker,
|
|
397
467
|
markerfacecolor=markerfacecolor,
|
|
398
468
|
markeredgecolor=markeredgecolor,
|
|
399
|
-
markersize=markersize,
|
|
400
|
-
markeredgewidth=markeredgewidth)
|
|
469
|
+
markersize=markersize*self.figure_scale_factor,
|
|
470
|
+
markeredgewidth=markeredgewidth*self.figure_scale_factor)
|
|
401
471
|
|
|
402
472
|
def add_significance_bars(self, ax,
|
|
403
473
|
linewidth=2,
|
|
@@ -417,13 +487,13 @@ class BaseStatPlot(Helpers):
|
|
|
417
487
|
|
|
418
488
|
match (self.print_p_label, self.print_stars):
|
|
419
489
|
case (True, True):
|
|
420
|
-
vspace = capsize+0.06
|
|
490
|
+
vspace = (capsize+0.06)*self.figure_scale_factor
|
|
421
491
|
label = '{}\n{}'.format(p, stars)
|
|
422
492
|
case (True, False):
|
|
423
|
-
vspace = capsize+0.03
|
|
493
|
+
vspace = (capsize+0.03)*self.figure_scale_factor
|
|
424
494
|
label = '{}'.format(p)
|
|
425
495
|
case (False, True):
|
|
426
|
-
vspace = capsize+0.03
|
|
496
|
+
vspace = (capsize+0.03)*self.figure_scale_factor
|
|
427
497
|
label = '{}'.format(stars)
|
|
428
498
|
|
|
429
499
|
if self.print_p_label or self.print_stars:
|
|
@@ -431,10 +501,10 @@ class BaseStatPlot(Helpers):
|
|
|
431
501
|
y, h = ((1.05 + (order*vspace)) *
|
|
432
502
|
self.y_max), capsize * self.y_max
|
|
433
503
|
ax.plot([x1, x1, x2, x2], [y, y + h, y + h, y],
|
|
434
|
-
lw=linewidth, c=col)
|
|
504
|
+
lw=linewidth*self.figure_scale_factor, c=col)
|
|
435
505
|
|
|
436
506
|
ax.text((x1 + x2) * 0.5, y + h, label,
|
|
437
|
-
ha='center', va='bottom', color=col, fontweight='bold', fontsize=8)
|
|
507
|
+
ha='center', va='bottom', color=col, fontweight='bold', fontsize=8*self.figure_scale_factor)
|
|
438
508
|
|
|
439
509
|
def draw_bar_from_posthoc_matrix(x1, x2, o):
|
|
440
510
|
draw_bar(
|
|
@@ -506,7 +576,7 @@ class BaseStatPlot(Helpers):
|
|
|
506
576
|
else:
|
|
507
577
|
ax.set_xticks(range(self.n_groups))
|
|
508
578
|
ax.set_xticklabels(['Group {}'.format(i + 1)
|
|
509
|
-
for i in range(self.n_groups)], fontweight='regular', fontsize=8)
|
|
579
|
+
for i in range(self.n_groups)], fontweight='regular', fontsize=8*self.figure_scale_factor)
|
|
510
580
|
else:
|
|
511
581
|
plt.subplots_adjust(bottom=0.08)
|
|
512
582
|
ax.tick_params(axis='x', which='both',
|
|
@@ -515,31 +585,37 @@ class BaseStatPlot(Helpers):
|
|
|
515
585
|
# Additional formatting
|
|
516
586
|
for ytick in ax.get_yticklabels():
|
|
517
587
|
ytick.set_fontweight('bold')
|
|
518
|
-
ax.tick_params(width=linewidth)
|
|
519
|
-
ax.xaxis.set_tick_params(labelsize=10)
|
|
520
|
-
ax.yaxis.set_tick_params(labelsize=12)
|
|
521
|
-
ax.spines['left'].set_linewidth(linewidth)
|
|
588
|
+
ax.tick_params(width=linewidth*self.figure_scale_factor)
|
|
589
|
+
ax.xaxis.set_tick_params(labelsize=10*self.figure_scale_factor)
|
|
590
|
+
ax.yaxis.set_tick_params(labelsize=12*self.figure_scale_factor)
|
|
591
|
+
ax.spines['left'].set_linewidth(linewidth*self.figure_scale_factor)
|
|
522
592
|
ax.tick_params(axis='y', which='both',
|
|
523
|
-
length=linewidth * 2, width=linewidth)
|
|
593
|
+
length=linewidth * 2*self.figure_scale_factor, width=linewidth*self.figure_scale_factor)
|
|
524
594
|
ax.tick_params(axis='x', which='both', length=0)
|
|
525
595
|
|
|
526
596
|
def add_titles_and_labels(self, fig, ax):
|
|
527
597
|
if self.plot_title:
|
|
528
|
-
ax.set_title(self.plot_title, fontsize=12
|
|
598
|
+
ax.set_title(self.plot_title, fontsize=12 *
|
|
599
|
+
self.figure_scale_factor, fontweight='bold')
|
|
529
600
|
if self.x_label:
|
|
530
|
-
ax.set_xlabel(self.x_label, fontsize=10
|
|
601
|
+
ax.set_xlabel(self.x_label, fontsize=10 *
|
|
602
|
+
self.figure_scale_factor, fontweight='bold')
|
|
531
603
|
if self.y_label:
|
|
532
|
-
ax.set_ylabel(self.y_label, fontsize=10
|
|
604
|
+
ax.set_ylabel(self.y_label, fontsize=10 *
|
|
605
|
+
self.figure_scale_factor, fontweight='bold')
|
|
533
606
|
fig.text(0.95, 0.0,
|
|
534
|
-
'{}
|
|
535
|
-
|
|
536
|
-
ha='right', va='bottom', fontsize=8, fontweight='regular')
|
|
607
|
+
'{}{}\nn={}'.format(self.testname, (', ' + self.posthoc_name) if self.posthoc_name else '',
|
|
608
|
+
str(self.n)[1:-1] if not self.dependent else str(self.n[0])),
|
|
609
|
+
ha='right', va='bottom', fontsize=8*self.figure_scale_factor, fontweight='regular')
|
|
537
610
|
|
|
538
611
|
def show(self):
|
|
539
612
|
plt.show()
|
|
540
613
|
|
|
541
614
|
def save(self, path):
|
|
542
|
-
plt.savefig(path
|
|
615
|
+
plt.savefig(path,
|
|
616
|
+
pad_inches=0.1*self.figure_scale_factor,
|
|
617
|
+
transparent=True,
|
|
618
|
+
)
|
|
543
619
|
|
|
544
620
|
def close(self):
|
|
545
621
|
plt.close()
|
|
@@ -566,7 +642,7 @@ class BarStatPlot(BaseStatPlot):
|
|
|
566
642
|
self.add_mean_marker(ax, x)
|
|
567
643
|
self.add_errorbar_sd(ax, x)
|
|
568
644
|
|
|
569
|
-
self.
|
|
645
|
+
self.add_swarm(ax)
|
|
570
646
|
self.add_significance_bars(ax, linewidth)
|
|
571
647
|
self.add_titles_and_labels(fig, ax)
|
|
572
648
|
self.axes_formatting(ax, linewidth)
|
|
@@ -599,7 +675,7 @@ class ViolinStatPlot(BaseStatPlot):
|
|
|
599
675
|
self.add_mean_marker(ax, x)
|
|
600
676
|
# self.add_errorbar_sd(ax, x)
|
|
601
677
|
|
|
602
|
-
self.
|
|
678
|
+
self.add_swarm(ax)
|
|
603
679
|
self.add_significance_bars(ax, linewidth)
|
|
604
680
|
self.add_titles_and_labels(fig, ax)
|
|
605
681
|
self.axes_formatting(ax, linewidth)
|
|
@@ -612,7 +688,7 @@ class BoxStatPlot(BaseStatPlot):
|
|
|
612
688
|
linewidth = 2
|
|
613
689
|
|
|
614
690
|
self.add_boxplot(ax)
|
|
615
|
-
self.
|
|
691
|
+
self.add_swarm(ax)
|
|
616
692
|
self.add_significance_bars(ax, linewidth)
|
|
617
693
|
self.add_titles_and_labels(fig, ax)
|
|
618
694
|
self.axes_formatting(ax, linewidth)
|
|
@@ -635,3 +711,28 @@ class ScatterStatPlot(BaseStatPlot):
|
|
|
635
711
|
self.add_significance_bars(ax, linewidth)
|
|
636
712
|
self.add_titles_and_labels(fig, ax)
|
|
637
713
|
self.axes_formatting(ax, linewidth)
|
|
714
|
+
|
|
715
|
+
xmin, xmax = ax.get_xlim()
|
|
716
|
+
ax.set_xlim(xmin - 0.25, xmax + 0.25)
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
class SwarmStatPlot(BaseStatPlot):
|
|
720
|
+
|
|
721
|
+
def plot(self):
|
|
722
|
+
fig, ax = self.setup_figure()
|
|
723
|
+
linewidth = 2
|
|
724
|
+
|
|
725
|
+
for x in range(len(self.data_groups)):
|
|
726
|
+
|
|
727
|
+
# Overlay errbars, and markers.
|
|
728
|
+
self.add_median_marker(ax, x)
|
|
729
|
+
self.add_mean_marker(ax, x)
|
|
730
|
+
self.add_errorbar_sd(ax, x)
|
|
731
|
+
|
|
732
|
+
self.add_swarm(ax)
|
|
733
|
+
self.add_significance_bars(ax, linewidth)
|
|
734
|
+
self.add_titles_and_labels(fig, ax)
|
|
735
|
+
self.axes_formatting(ax, linewidth)
|
|
736
|
+
|
|
737
|
+
xmin, xmax = ax.get_xlim()
|
|
738
|
+
ax.set_xlim(xmin - 0.25, xmax + 0.25)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# AutoStatLib package version:
|
|
2
|
-
__version__ = "0.2.
|
|
2
|
+
__version__ = "0.2.16"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AutoStatLib
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.16
|
|
4
4
|
Summary: AutoStatLib - a simple statistical analysis tool
|
|
5
5
|
Author: Stemonitis, SciWare LLC
|
|
6
6
|
Author-email: konung-yaropolk <yaropolk1995@gmail.com>
|
|
@@ -533,6 +533,7 @@ Requires-Dist: numpy
|
|
|
533
533
|
Requires-Dist: scipy
|
|
534
534
|
Requires-Dist: statsmodels
|
|
535
535
|
Requires-Dist: matplotlib
|
|
536
|
+
Requires-Dist: seaborn
|
|
536
537
|
Requires-Dist: scikit-posthocs
|
|
537
538
|
Requires-Dist: pandas
|
|
538
539
|
Dynamic: license-file
|
|
@@ -675,22 +676,22 @@ If errors occured, *GetResult()* returns an empty dictionary
|
|
|
675
676
|
-- add QQ plot
|
|
676
677
|
-- n-sample tests: add onetail option
|
|
677
678
|
|
|
678
|
-
✅ done -- detailed normality test results
|
|
679
|
-
✅ done -- added posthoc: Kruskal-Wallis Dunn's multiple comparisons
|
|
680
|
-
|
|
681
|
-
tests check:
|
|
682
|
-
1-sample:
|
|
683
|
-
--Wilcoxon 2,1 tails - ✅ok
|
|
684
|
-
--t-tests 2,1 tails -✅ok
|
|
685
|
-
|
|
686
|
-
2-sample:
|
|
687
|
-
--Wilcoxon 2,1 tails - ✅ok
|
|
688
|
-
--Mann-whitney 2,1 tails - ✅ok
|
|
689
|
-
--t-tests 2,1 tails -✅ok
|
|
690
|
-
|
|
691
|
-
n-sample:
|
|
692
|
-
--Kruskal-Wallis 2 tail - ✅ok
|
|
693
|
-
--Dunn's multiple comparisons - ✅ok
|
|
694
|
-
--Friedman 2 tail - ✅ok
|
|
695
|
-
--one-way ANOWA 2 tail - ✅ok
|
|
696
|
-
--Tukey`s multiple comparisons - ✅ok
|
|
679
|
+
✅ done -- detailed normality test results
|
|
680
|
+
✅ done -- added posthoc: Kruskal-Wallis Dunn's multiple comparisons
|
|
681
|
+
|
|
682
|
+
tests check:
|
|
683
|
+
1-sample:
|
|
684
|
+
--Wilcoxon 2,1 tails - ✅ok
|
|
685
|
+
--t-tests 2,1 tails -✅ok
|
|
686
|
+
|
|
687
|
+
2-sample:
|
|
688
|
+
--Wilcoxon 2,1 tails - ✅ok
|
|
689
|
+
--Mann-whitney 2,1 tails - ✅ok
|
|
690
|
+
--t-tests 2,1 tails -✅ok
|
|
691
|
+
|
|
692
|
+
n-sample:
|
|
693
|
+
--Kruskal-Wallis 2 tail - ✅ok
|
|
694
|
+
--Dunn's multiple comparisons - ✅ok
|
|
695
|
+
--Friedman 2 tail - ✅ok
|
|
696
|
+
--one-way ANOWA 2 tail - ✅ok
|
|
697
|
+
--Tukey`s multiple comparisons - ✅ok
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|