AutoStatLib 0.2.13__tar.gz → 0.2.14__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.

Files changed (21) hide show
  1. {autostatlib-0.2.13/src/AutoStatLib.egg-info → autostatlib-0.2.14}/PKG-INFO +1 -1
  2. {autostatlib-0.2.13 → autostatlib-0.2.14}/src/AutoStatLib/StatPlots.py +53 -30
  3. {autostatlib-0.2.13 → autostatlib-0.2.14}/src/AutoStatLib/_version.py +1 -1
  4. {autostatlib-0.2.13 → autostatlib-0.2.14/src/AutoStatLib.egg-info}/PKG-INFO +1 -1
  5. {autostatlib-0.2.13 → autostatlib-0.2.14}/LICENSE +0 -0
  6. {autostatlib-0.2.13 → autostatlib-0.2.14}/MANIFEST.in +0 -0
  7. {autostatlib-0.2.13 → autostatlib-0.2.14}/README.md +0 -0
  8. {autostatlib-0.2.13 → autostatlib-0.2.14}/pyproject.toml +0 -0
  9. {autostatlib-0.2.13 → autostatlib-0.2.14}/requirements.txt +0 -0
  10. {autostatlib-0.2.13 → autostatlib-0.2.14}/setup.cfg +0 -0
  11. {autostatlib-0.2.13 → autostatlib-0.2.14}/src/AutoStatLib/AutoStatLib.py +0 -0
  12. {autostatlib-0.2.13 → autostatlib-0.2.14}/src/AutoStatLib/__init__.py +0 -0
  13. {autostatlib-0.2.13 → autostatlib-0.2.14}/src/AutoStatLib/__main__.py +0 -0
  14. {autostatlib-0.2.13 → autostatlib-0.2.14}/src/AutoStatLib/helpers.py +0 -0
  15. {autostatlib-0.2.13 → autostatlib-0.2.14}/src/AutoStatLib/normality_tests.py +0 -0
  16. {autostatlib-0.2.13 → autostatlib-0.2.14}/src/AutoStatLib/statistical_tests.py +0 -0
  17. {autostatlib-0.2.13 → autostatlib-0.2.14}/src/AutoStatLib/text_formatting.py +0 -0
  18. {autostatlib-0.2.13 → autostatlib-0.2.14}/src/AutoStatLib.egg-info/SOURCES.txt +0 -0
  19. {autostatlib-0.2.13 → autostatlib-0.2.14}/src/AutoStatLib.egg-info/dependency_links.txt +0 -0
  20. {autostatlib-0.2.13 → autostatlib-0.2.14}/src/AutoStatLib.egg-info/requires.txt +0 -0
  21. {autostatlib-0.2.13 → autostatlib-0.2.14}/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.13
3
+ Version: 0.2.14
4
4
  Summary: AutoStatLib - a simple statistical analysis tool
5
5
  Author: Stemonitis, SciWare LLC
6
6
  Author-email: konung-yaropolk <yaropolk1995@gmail.com>
@@ -87,6 +87,9 @@ class BaseStatPlot(Helpers):
87
87
  colormap=None,
88
88
  print_p_label=True,
89
89
  print_stars=True,
90
+ figure_scale_factor=1,
91
+ figure_h=4,
92
+ figure_w=0, # 0 means auto
90
93
  **kwargs):
91
94
  self.data_groups = [group if group else [0, 0, 0, 0]
92
95
  for group in data_groups]
@@ -103,6 +106,9 @@ class BaseStatPlot(Helpers):
103
106
  self.print_p_label = print_p_label
104
107
  self.print_stars = print_stars
105
108
  self.print_x_labels = print_x_labels
109
+ self.figure_scale_factor = figure_scale_factor
110
+ self.figure_h = figure_h
111
+ self.figure_w = figure_w
106
112
 
107
113
  # sd sem mean and median calculation if they are not provided
108
114
  self.mean = [
@@ -132,13 +138,22 @@ class BaseStatPlot(Helpers):
132
138
  self.y_max = max([max(data) for data in self.data_groups])
133
139
 
134
140
  def setup_figure(self, ):
135
- fig, ax = plt.subplots(figsize=(0.5 + 0.9 * self.n_groups, 4))
141
+ fig, ax = plt.subplots(
142
+ dpi=100,
143
+ figsize=((0.5 + 0.9 * self.n_groups)
144
+ if not self.figure_w else self.figure_w, self.figure_h)
145
+ )
146
+
147
+ figure_size = plt.gcf().get_size_inches()
148
+ plt.gcf().set_size_inches(self.figure_scale_factor * figure_size)
149
+
136
150
  return fig, ax
137
151
 
138
152
  def add_scatter(self, ax,
139
153
  color='k',
140
154
  alpha=0.5,
141
155
  marker='o',
156
+ markersize=6,
142
157
  linewidth=1,
143
158
  zorder=1):
144
159
  # Generate x jitter pool.
@@ -153,7 +168,8 @@ class BaseStatPlot(Helpers):
153
168
  color=color,
154
169
  alpha=alpha,
155
170
  marker=marker,
156
- linewidth=linewidth,
171
+ markersize=markersize*self.figure_scale_factor,
172
+ linewidth=linewidth*self.figure_scale_factor,
157
173
  # Connect the data points if desired.
158
174
  linestyle='-' if self.dependent else '',
159
175
  zorder=zorder)
@@ -169,7 +185,7 @@ class BaseStatPlot(Helpers):
169
185
  facecolor=self.colors_fill[x % len(self.colors_fill)],
170
186
  edgecolor=self.colors_edge[x % len(self.colors_edge)],
171
187
  fill=fill,
172
- linewidth=linewidth,
188
+ linewidth=linewidth*self.figure_scale_factor,
173
189
  zorder=zorder)
174
190
 
175
191
  def add_violinplot(self, ax, x,
@@ -189,7 +205,7 @@ class BaseStatPlot(Helpers):
189
205
  for pc in vp['bodies']:
190
206
  pc.set_facecolor(self.colors_fill[x % len(self.colors_fill)])
191
207
  pc.set_edgecolor(self.colors_edge[x % len(self.colors_edge)])
192
- pc.set_linewidth(linewidth)
208
+ pc.set_linewidth(linewidth*self.figure_scale_factor)
193
209
 
194
210
  def add_boxplot(self, ax,
195
211
  # positions of boxes, defaults to range(1,n+1)
@@ -352,9 +368,9 @@ class BaseStatPlot(Helpers):
352
368
  ax.errorbar(x, self.mean[x],
353
369
  yerr=self.sd[x],
354
370
  fmt='none',
355
- capsize=capsize,
371
+ capsize=capsize*self.figure_scale_factor,
356
372
  ecolor=ecolor,
357
- linewidth=linewidth,
373
+ linewidth=linewidth*self.figure_scale_factor,
358
374
  zorder=zorder)
359
375
 
360
376
  def add_errorbar_sem(self, ax, x,
@@ -366,9 +382,10 @@ class BaseStatPlot(Helpers):
366
382
  ax.errorbar(x, self.mean[x],
367
383
  yerr=self.sem[x],
368
384
  fmt='none',
369
- capsize=capsize,
385
+ capsize=capsize*self.figure_scale_factor,
370
386
  ecolor=ecolor,
371
- linewidth=linewidth,
387
+ linewidth=linewidth*self.figure_scale_factor,
388
+ elinewidth=linewidth*self.figure_scale_factor,
372
389
  zorder=zorder)
373
390
 
374
391
  def add_mean_marker(self, ax, x,
@@ -382,8 +399,8 @@ class BaseStatPlot(Helpers):
382
399
  marker=marker,
383
400
  markerfacecolor=markerfacecolor,
384
401
  markeredgecolor=markeredgecolor,
385
- markersize=markersize,
386
- markeredgewidth=markeredgewidth)
402
+ markersize=markersize*self.figure_scale_factor,
403
+ markeredgewidth=markeredgewidth*self.figure_scale_factor)
387
404
 
388
405
  def add_median_marker(self, ax, x,
389
406
  marker='x',
@@ -396,8 +413,8 @@ class BaseStatPlot(Helpers):
396
413
  marker=marker,
397
414
  markerfacecolor=markerfacecolor,
398
415
  markeredgecolor=markeredgecolor,
399
- markersize=markersize,
400
- markeredgewidth=markeredgewidth)
416
+ markersize=markersize*self.figure_scale_factor,
417
+ markeredgewidth=markeredgewidth*self.figure_scale_factor)
401
418
 
402
419
  def add_significance_bars(self, ax,
403
420
  linewidth=2,
@@ -417,13 +434,13 @@ class BaseStatPlot(Helpers):
417
434
 
418
435
  match (self.print_p_label, self.print_stars):
419
436
  case (True, True):
420
- vspace = capsize+0.06
437
+ vspace = (capsize+0.06)*self.figure_scale_factor
421
438
  label = '{}\n{}'.format(p, stars)
422
439
  case (True, False):
423
- vspace = capsize+0.03
440
+ vspace = (capsize+0.03)*self.figure_scale_factor
424
441
  label = '{}'.format(p)
425
442
  case (False, True):
426
- vspace = capsize+0.03
443
+ vspace = (capsize+0.03)*self.figure_scale_factor
427
444
  label = '{}'.format(stars)
428
445
 
429
446
  if self.print_p_label or self.print_stars:
@@ -431,10 +448,10 @@ class BaseStatPlot(Helpers):
431
448
  y, h = ((1.05 + (order*vspace)) *
432
449
  self.y_max), capsize * self.y_max
433
450
  ax.plot([x1, x1, x2, x2], [y, y + h, y + h, y],
434
- lw=linewidth, c=col)
451
+ lw=linewidth*self.figure_scale_factor, c=col)
435
452
 
436
453
  ax.text((x1 + x2) * 0.5, y + h, label,
437
- ha='center', va='bottom', color=col, fontweight='bold', fontsize=8)
454
+ ha='center', va='bottom', color=col, fontweight='bold', fontsize=8*self.figure_scale_factor)
438
455
 
439
456
  def draw_bar_from_posthoc_matrix(x1, x2, o):
440
457
  draw_bar(
@@ -506,7 +523,7 @@ class BaseStatPlot(Helpers):
506
523
  else:
507
524
  ax.set_xticks(range(self.n_groups))
508
525
  ax.set_xticklabels(['Group {}'.format(i + 1)
509
- for i in range(self.n_groups)], fontweight='regular', fontsize=8)
526
+ for i in range(self.n_groups)], fontweight='regular', fontsize=8*self.figure_scale_factor)
510
527
  else:
511
528
  plt.subplots_adjust(bottom=0.08)
512
529
  ax.tick_params(axis='x', which='both',
@@ -515,31 +532,37 @@ class BaseStatPlot(Helpers):
515
532
  # Additional formatting
516
533
  for ytick in ax.get_yticklabels():
517
534
  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)
535
+ ax.tick_params(width=linewidth*self.figure_scale_factor)
536
+ ax.xaxis.set_tick_params(labelsize=10*self.figure_scale_factor)
537
+ ax.yaxis.set_tick_params(labelsize=12*self.figure_scale_factor)
538
+ ax.spines['left'].set_linewidth(linewidth*self.figure_scale_factor)
522
539
  ax.tick_params(axis='y', which='both',
523
- length=linewidth * 2, width=linewidth)
540
+ length=linewidth * 2*self.figure_scale_factor, width=linewidth*self.figure_scale_factor)
524
541
  ax.tick_params(axis='x', which='both', length=0)
525
542
 
526
543
  def add_titles_and_labels(self, fig, ax):
527
544
  if self.plot_title:
528
- ax.set_title(self.plot_title, fontsize=12, fontweight='bold')
545
+ ax.set_title(self.plot_title, fontsize=12 *
546
+ self.figure_scale_factor, fontweight='bold')
529
547
  if self.x_label:
530
- ax.set_xlabel(self.x_label, fontsize=10, fontweight='bold')
548
+ ax.set_xlabel(self.x_label, fontsize=10 *
549
+ self.figure_scale_factor, fontweight='bold')
531
550
  if self.y_label:
532
- ax.set_ylabel(self.y_label, fontsize=10, fontweight='bold')
551
+ ax.set_ylabel(self.y_label, fontsize=10 *
552
+ self.figure_scale_factor, fontweight='bold')
533
553
  fig.text(0.95, 0.0,
534
- '{}, {}\nn={}'.format(self.testname, self.posthoc_name,
535
- str(self.n)[1:-1] if not self.dependent else str(self.n[0])),
536
- ha='right', va='bottom', fontsize=8, fontweight='regular')
554
+ '{}{}\nn={}'.format(self.testname, (', ' + self.posthoc_name) if self.posthoc_name else '',
555
+ str(self.n)[1:-1] if not self.dependent else str(self.n[0])),
556
+ ha='right', va='bottom', fontsize=8*self.figure_scale_factor, fontweight='regular')
537
557
 
538
558
  def show(self):
539
559
  plt.show()
540
560
 
541
561
  def save(self, path):
542
- plt.savefig(path)
562
+ plt.savefig(path,
563
+ pad_inches=0.1*self.figure_scale_factor,
564
+ transparent=True,
565
+ )
543
566
 
544
567
  def close(self):
545
568
  plt.close()
@@ -1,2 +1,2 @@
1
1
  # AutoStatLib package version:
2
- __version__ = "0.2.13"
2
+ __version__ = "0.2.14"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: AutoStatLib
3
- Version: 0.2.13
3
+ Version: 0.2.14
4
4
  Summary: AutoStatLib - a simple statistical analysis tool
5
5
  Author: Stemonitis, SciWare LLC
6
6
  Author-email: konung-yaropolk <yaropolk1995@gmail.com>
File without changes
File without changes
File without changes
File without changes