lessPython 0.2.0__tar.gz → 0.3.1__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.
- {lesspython-0.2.0/src/lessPython.egg-info → lesspython-0.3.1}/PKG-INFO +13 -2
- {lesspython-0.2.0 → lesspython-0.3.1}/README.md +12 -1
- {lesspython-0.2.0 → lesspython-0.3.1}/pyproject.toml +1 -1
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/ANOVA.py +74 -15
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/Chart.py +431 -88
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/Correlation.py +40 -11
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/Flows.py +3 -3
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/Logit.py +15 -11
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/Regression.py +27 -21
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/X.py +280 -42
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/XY.py +1332 -239
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/__init__.py +12 -2
- lesspython-0.3.1/src/lessPy/_themes.py +5007 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/bc_items_plotly.py +33 -20
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/bc_plotly.py +27 -10
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/bubble_plotly.py +33 -17
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/corCFA.py +9 -5
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/corProp.py +8 -4
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/corReflect.py +8 -4
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/corReorder.py +8 -4
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/corScree.py +12 -8
- lesspython-0.3.1/src/lessPy/data/StockPrice.csv +1504 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/details.py +17 -4
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/dn_plotly.py +74 -54
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/dot_plotly.py +9 -8
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/freq_poly_plotly.py +18 -11
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/getColors.py +247 -20
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/hier_plotly.py +41 -14
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/hs_plotly.py +23 -11
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/pie_plotly.py +1 -1
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/pivot.py +39 -9
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/plotly_utils.py +162 -29
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/plt_add.py +2 -7
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/plt_contour.py +6 -6
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/plt_contour_facet.py +3 -3
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/plt_mat_plotly.py +85 -12
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/plt_plotly.py +34 -18
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/plt_smooth.py +4 -4
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/plt_time.py +10 -3
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/prob_norm.py +7 -3
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/prob_tcut.py +7 -3
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/prob_znorm.py +7 -1
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/profile_plotly.py +5 -4
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/radar_plotly.py +4 -3
- lesspython-0.3.1/src/lessPy/rcolors.py +461 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/simCImean.py +7 -3
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/simCLT.py +7 -3
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/simFlips.py +7 -3
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/simMeans.py +7 -3
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/stats_out.py +257 -11
- lesspython-0.3.1/src/lessPy/style.py +167 -0
- lesspython-0.3.1/src/lessPy/sunflower_plotly.py +141 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/ttest.py +17 -13
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/utils.py +146 -6
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/vbs_plotly.py +39 -27
- lesspython-0.3.1/src/lessPy/x_console.py +763 -0
- {lesspython-0.2.0 → lesspython-0.3.1/src/lessPython.egg-info}/PKG-INFO +13 -2
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPython.egg-info/SOURCES.txt +17 -1
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_anova.py +10 -1
- lesspython-0.3.1/tests/test_by_colors.py +96 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_chart.py +84 -14
- lesspython-0.3.1/tests/test_chart_colors.py +64 -0
- lesspython-0.3.1/tests/test_chart_items.py +135 -0
- lesspython-0.3.1/tests/test_chart_ordered_fill.py +50 -0
- lesspython-0.3.1/tests/test_chart_stats.py +90 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_details.py +14 -0
- lesspython-0.3.1/tests/test_file_output.py +77 -0
- lesspython-0.3.1/tests/test_getcolors_r_palettes.py +57 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_hier_plotly.py +22 -0
- lesspython-0.3.1/tests/test_lessr_457_oct.py +171 -0
- lesspython-0.3.1/tests/test_plot_fixes.py +231 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_stats_out.py +12 -9
- lesspython-0.3.1/tests/test_style.py +95 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_x.py +69 -11
- lesspython-0.3.1/tests/test_x_console.py +260 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_xy.py +160 -18
- lesspython-0.3.1/tests/test_xy_console.py +118 -0
- lesspython-0.2.0/src/lessPy/data/StockPrice.csv +0 -1489
- lesspython-0.2.0/tests/test_chart_items.py +0 -75
- {lesspython-0.2.0 → lesspython-0.3.1}/LICENSE +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/setup.cfg +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/Prop_test.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/VariableLabels.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/anova_rmd.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/corEFA.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/corPrint.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/corRead.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/Anova_1way.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/Anova_2way.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/Anova_rb.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/Anova_rbf.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/Anova_sp.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/BodyMeas.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/Cars93.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/Employee.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/Employee_lbl.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/FreqTable99.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/Jackets.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/Learn.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/Mach4.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/Mach4_lbl.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/Reading.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/data/WeightLoss.csv +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/datasets.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/date_infer.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/logit_rmd.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/order_by.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/plt_forecast.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/reg_rmd.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/rename.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/reshape.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPy/showColors.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPython.egg-info/dependency_links.txt +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPython.egg-info/requires.txt +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/src/lessPython.egg-info/top_level.txt +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_bc_plotly.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_bubble_plotly.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_corcfa.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_corefa.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_corprint.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_corprop.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_corread.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_correflect.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_correlation.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_correorder.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_corscree.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_datasets.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_date_infer.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_dot_plotly.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_flows.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_getcolors.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_logit.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_order_by.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_pie_plotly.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_pivot.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_prob_norm.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_prob_tcut.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_prob_znorm.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_profile.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_prop_test.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_radar_plotly.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_regression.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_rename.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_reshape.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_showcolors.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_simcimean.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_simclt.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_simflips.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_simmeans.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_ttest.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_variablelabels.py +0 -0
- {lesspython-0.2.0 → lesspython-0.3.1}/tests/test_vbs_plotly.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lessPython
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Python port of R's lessR: analytic-view visualizations, statistical models, and data utilities, rendered with plotly
|
|
5
5
|
Author-email: "David W. Gerbing" <gerbing@pdx.edu>
|
|
6
6
|
License-Expression: GPL-2.0-or-later
|
|
@@ -113,7 +113,18 @@ of functions, grouped by category for navigation:
|
|
|
113
113
|
|
|
114
114
|
The inferential functions print their analysis as in lessR and
|
|
115
115
|
also return a results object whose numeric fields and plotly
|
|
116
|
-
figures (in `.plots`) are available for programmatic use.
|
|
116
|
+
figures (in `.plots`) are available for programmatic use. In a
|
|
117
|
+
notebook, such as Jupyter or Colab, the figures also display
|
|
118
|
+
when the analysis runs, even when the result is assigned, as
|
|
119
|
+
`r = lp.Regression(...)`. From a script, show one with
|
|
120
|
+
`r.plots["scatter"].show()`.
|
|
121
|
+
|
|
122
|
+
Every function that draws also takes `pdf_file=` and `png_file=`
|
|
123
|
+
(needs the png extra, `pip install "lessPython[png]"`, then
|
|
124
|
+
`plotly_get_chrome -y` once). A name such as `png_file="reg"`
|
|
125
|
+
names the file, or with several figures is the stem of each
|
|
126
|
+
name (`reg_scatter_matrix.png`), as lessR's `pdf_file=`. On Colab
|
|
127
|
+
the files also download to your computer.
|
|
117
128
|
|
|
118
129
|
## Development install
|
|
119
130
|
|
|
@@ -76,7 +76,18 @@ of functions, grouped by category for navigation:
|
|
|
76
76
|
|
|
77
77
|
The inferential functions print their analysis as in lessR and
|
|
78
78
|
also return a results object whose numeric fields and plotly
|
|
79
|
-
figures (in `.plots`) are available for programmatic use.
|
|
79
|
+
figures (in `.plots`) are available for programmatic use. In a
|
|
80
|
+
notebook, such as Jupyter or Colab, the figures also display
|
|
81
|
+
when the analysis runs, even when the result is assigned, as
|
|
82
|
+
`r = lp.Regression(...)`. From a script, show one with
|
|
83
|
+
`r.plots["scatter"].show()`.
|
|
84
|
+
|
|
85
|
+
Every function that draws also takes `pdf_file=` and `png_file=`
|
|
86
|
+
(needs the png extra, `pip install "lessPython[png]"`, then
|
|
87
|
+
`plotly_get_chrome -y` once). A name such as `png_file="reg"`
|
|
88
|
+
names the file, or with several figures is the stem of each
|
|
89
|
+
name (`reg_scatter_matrix.png`), as lessR's `pdf_file=`. On Colab
|
|
90
|
+
the files also download to your computer.
|
|
80
91
|
|
|
81
92
|
## Development install
|
|
82
93
|
|
|
@@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"
|
|
|
12
12
|
|
|
13
13
|
[project]
|
|
14
14
|
name = "lessPython"
|
|
15
|
-
version = "0.
|
|
15
|
+
version = "0.3.1"
|
|
16
16
|
description = "Python port of R's lessR: analytic-view visualizations, statistical models, and data utilities, rendered with plotly"
|
|
17
17
|
authors = [{ name = "David W. Gerbing", email = "gerbing@pdx.edu" }]
|
|
18
18
|
readme = "README.md"
|
|
@@ -22,10 +22,10 @@ import pandas as pd
|
|
|
22
22
|
import plotly.graph_objects as go
|
|
23
23
|
|
|
24
24
|
from .plotly_utils import (
|
|
25
|
-
BASE_COLORS, axis_cat, axis_format, axis_num, make_trans,
|
|
25
|
+
as_plotly_color, BASE_COLORS, axis_cat, axis_format, axis_num, make_trans,
|
|
26
26
|
plot_border, plotly_style, to_hex, x_grid)
|
|
27
27
|
from .Regression import _getdigits, _prntbl
|
|
28
|
-
from .utils import fmt, get_column, get_option, pretty
|
|
28
|
+
from .utils import fmt, get_column, get_option, pretty, file_output, show_plots
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
class ANOVAResults:
|
|
@@ -380,18 +380,73 @@ def _oneway(fit, yv, gv, y_name, x_name, levels, n_keep, d,
|
|
|
380
380
|
lines += _prntbl(tukey, d).split("\n")
|
|
381
381
|
|
|
382
382
|
plots = {}
|
|
383
|
+
if graphics and tukey is not None:
|
|
384
|
+
plots["tukey"] = _tukey_plot(tukey, x_name, d)
|
|
383
385
|
if graphics:
|
|
384
386
|
plots["means"] = _anova_means_plot(
|
|
385
387
|
yv, gv, y_name, x_name, levels, jitter_x, d)
|
|
386
388
|
|
|
387
|
-
return ANOVAResults(
|
|
389
|
+
return show_plots(ANOVAResults(
|
|
388
390
|
formula=formula, design="oneway", n_obs=n_obs,
|
|
389
391
|
n_keep=n_keep, digits_d=d, response=y_name,
|
|
390
392
|
factors=[x_name], descriptive=desc, grand_mean=grand,
|
|
391
393
|
anova=tbl,
|
|
392
394
|
effects={"R_squared": rsq, "R_sq_adjusted": rsq_adj,
|
|
393
395
|
"omega_squared": omsq, "cohen_f": cohen_f},
|
|
394
|
-
tukey=tukey, plots=plots)
|
|
396
|
+
tukey=tukey, plots=plots))
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
def _tukey_plot(tukey, x_name, d):
|
|
400
|
+
"""Each pairwise difference of means with its 95% family-wise
|
|
401
|
+
interval, the first comparison at the top, and a dashed
|
|
402
|
+
reference line at 0. ~ .ANOVAz1 plot(TukeyHSD())"""
|
|
403
|
+
style = plotly_style()
|
|
404
|
+
k = len(tukey)
|
|
405
|
+
ypos = list(range(k, 0, -1))
|
|
406
|
+
col = as_plotly_color(get_option("pt_color", "#324E5C"))
|
|
407
|
+
fig = go.Figure()
|
|
408
|
+
for yp, (lbl, r) in zip(ypos, tukey.iterrows()):
|
|
409
|
+
fig.add_trace(go.Scatter(
|
|
410
|
+
x=[r["lwr"], r["upr"]], y=[yp, yp], mode="lines",
|
|
411
|
+
line=dict(color=col, width=2), hoverinfo="skip",
|
|
412
|
+
showlegend=False))
|
|
413
|
+
fig.add_trace(go.Scatter(
|
|
414
|
+
x=tukey["diff"], y=ypos, mode="markers",
|
|
415
|
+
marker=dict(symbol="circle", size=9, color=col),
|
|
416
|
+
customdata=np.column_stack([tukey["lwr"], tukey["upr"],
|
|
417
|
+
tukey["p adj"]]),
|
|
418
|
+
text=list(tukey.index),
|
|
419
|
+
hovertemplate=("%{text}<br>diff: %{x:." + str(d) + "f}"
|
|
420
|
+
"<br>95% CI: %{customdata[0]:." + str(d)
|
|
421
|
+
+ "f} to %{customdata[1]:." + str(d) + "f}"
|
|
422
|
+
"<br>p adj: %{customdata[2]:.3f}"
|
|
423
|
+
"<extra></extra>"),
|
|
424
|
+
showlegend=False))
|
|
425
|
+
axT1 = pretty(min(0.0, float(tukey["lwr"].min())),
|
|
426
|
+
max(0.0, float(tukey["upr"].max())))
|
|
427
|
+
ax_x = axis_num(f"Differences in mean levels of {x_name}", axT1,
|
|
428
|
+
axis_format(axT1, d))
|
|
429
|
+
ax_x.update(showgrid=True,
|
|
430
|
+
gridcolor=as_plotly_color(style["grid_col"]),
|
|
431
|
+
gridwidth=1, griddash="dot",
|
|
432
|
+
range=[axT1[0], axT1[-1]], zeroline=False)
|
|
433
|
+
ax_y = axis_cat("")
|
|
434
|
+
ax_y.update(tickmode="array", tickvals=ypos,
|
|
435
|
+
ticktext=list(tukey.index), range=[0.5, k + 0.5])
|
|
436
|
+
zero = dict(type="line", xref="x", yref="paper", x0=0, x1=0,
|
|
437
|
+
y0=0, y1=1, layer="below",
|
|
438
|
+
line=dict(color=as_plotly_color("gray50"), width=1,
|
|
439
|
+
dash="dash"))
|
|
440
|
+
fig.update_layout(
|
|
441
|
+
xaxis=ax_x, yaxis=ax_y, shapes=[zero] + list(plot_border()),
|
|
442
|
+
template=None,
|
|
443
|
+
plot_bgcolor=as_plotly_color(style["panel_fill"]),
|
|
444
|
+
paper_bgcolor=as_plotly_color(style["window_fill"]),
|
|
445
|
+
title=dict(text="95% family-wise confidence level",
|
|
446
|
+
x=0.5, xanchor="center",
|
|
447
|
+
font=dict(size=round(
|
|
448
|
+
16 * get_option("main_size", 1)))))
|
|
449
|
+
return fig
|
|
395
450
|
|
|
396
451
|
|
|
397
452
|
def _anova_means_plot(yv, gv, y_name, x_name, levels, jitter_x,
|
|
@@ -410,18 +465,18 @@ def _anova_means_plot(yv, gv, y_name, x_name, levels, jitter_x,
|
|
|
410
465
|
x=xn, y=yv, mode="markers",
|
|
411
466
|
marker=dict(symbol="circle", size=6,
|
|
412
467
|
color=make_trans(pt, 0.85), opacity=1,
|
|
413
|
-
line=dict(color=
|
|
468
|
+
line=dict(color=as_plotly_color(pt), width=1)),
|
|
414
469
|
hoverinfo="y", showlegend=False))
|
|
415
470
|
means = [yv[gv == lv].mean() for lv in levels]
|
|
416
471
|
for i, mval in enumerate(means):
|
|
417
472
|
fig.add_shape(type="line", xref="x", yref="y",
|
|
418
473
|
x0=-0.5, x1=len(levels) - 0.5,
|
|
419
474
|
y0=mval, y1=mval, layer="below",
|
|
420
|
-
line=dict(color=
|
|
475
|
+
line=dict(color=as_plotly_color("gray70"), width=1))
|
|
421
476
|
fig.add_trace(go.Scatter(
|
|
422
477
|
x=list(range(len(levels))), y=means, mode="markers",
|
|
423
478
|
marker=dict(symbol="diamond", size=13,
|
|
424
|
-
color=
|
|
479
|
+
color=as_plotly_color(get_option("fit_color",
|
|
425
480
|
"#5C4032"))),
|
|
426
481
|
hoverinfo="x+y", showlegend=False))
|
|
427
482
|
axT2 = pretty(float(yv.min()), float(yv.max()))
|
|
@@ -431,13 +486,13 @@ def _anova_means_plot(yv, gv, y_name, x_name, levels, jitter_x,
|
|
|
431
486
|
ticktext=levels, range=[-0.5, len(levels) - 0.5])
|
|
432
487
|
ax_y = axis_num(y_name, axT2, axis_format(axT2, d))
|
|
433
488
|
ax_y.update(showgrid=True,
|
|
434
|
-
gridcolor=
|
|
489
|
+
gridcolor=as_plotly_color(style["grid_col"]),
|
|
435
490
|
gridwidth=1, griddash="dot")
|
|
436
491
|
fig.update_layout(
|
|
437
492
|
xaxis=ax_x, yaxis=ax_y, shapes=fig.layout.shapes
|
|
438
493
|
+ tuple(plot_border()), template=None,
|
|
439
|
-
plot_bgcolor=
|
|
440
|
-
paper_bgcolor=
|
|
494
|
+
plot_bgcolor=as_plotly_color(style["panel_fill"]),
|
|
495
|
+
paper_bgcolor=as_plotly_color(style["window_fill"]),
|
|
441
496
|
title=dict(text="Scatterplot with Cell Means",
|
|
442
497
|
x=0.5, xanchor="center",
|
|
443
498
|
font=dict(size=round(
|
|
@@ -611,12 +666,12 @@ def _twoway(fit, yv, fvals, y_name, facs, flevs, n_keep, d,
|
|
|
611
666
|
x1v, np.asarray(fit.fittedvalues), x2v,
|
|
612
667
|
"Fitted", f1, f2, l1, l2, d, "Fitted Values")
|
|
613
668
|
|
|
614
|
-
return ANOVAResults(
|
|
669
|
+
return show_plots(ANOVAResults(
|
|
615
670
|
formula=formula, design=design, n_obs=n_obs,
|
|
616
671
|
n_keep=n_keep, digits_d=d, response=y_name,
|
|
617
672
|
factors=[f1, f2], cell_n=cell_n,
|
|
618
673
|
marginal_means={f1: m1, f2: m2}, grand_mean=grand,
|
|
619
|
-
anova=t, effects=eff, tukey=tukey, plots=plots)
|
|
674
|
+
anova=t, effects=eff, tukey=tukey, plots=plots))
|
|
620
675
|
|
|
621
676
|
|
|
622
677
|
def _cat_line_fig(title, x_name, y_name, levels_x, series, d,
|
|
@@ -644,13 +699,13 @@ def _cat_line_fig(title, x_name, y_name, levels_x, series, d,
|
|
|
644
699
|
range=[-0.4, len(levels_x) - 0.6])
|
|
645
700
|
ax_y = axis_num(y_name, axT2, axis_format(axT2, d))
|
|
646
701
|
ax_y.update(showgrid=True,
|
|
647
|
-
gridcolor=
|
|
702
|
+
gridcolor=as_plotly_color(style["grid_col"]),
|
|
648
703
|
gridwidth=1, griddash="dot")
|
|
649
704
|
fig.update_layout(
|
|
650
705
|
xaxis=ax_x, yaxis=ax_y, shapes=plot_border(),
|
|
651
706
|
template=None, legend=dict(title=dict(text=legend_title)),
|
|
652
|
-
plot_bgcolor=
|
|
653
|
-
paper_bgcolor=
|
|
707
|
+
plot_bgcolor=as_plotly_color(style["panel_fill"]),
|
|
708
|
+
paper_bgcolor=as_plotly_color(style["window_fill"]),
|
|
654
709
|
title=dict(text=title, x=0.5, xanchor="center",
|
|
655
710
|
font=dict(size=round(
|
|
656
711
|
16 * get_option("main_size", 1)))))
|
|
@@ -678,3 +733,7 @@ def _blocks_plot(x1v, yvals, x2v, y_name, f1, f2, l1, l2, d,
|
|
|
678
733
|
sub = dp[dp["b"] == b].set_index("a")["y"]
|
|
679
734
|
series.append((b, [sub.get(a, np.nan) for a in l1]))
|
|
680
735
|
return _cat_line_fig(title, f1, y_name, l1, series, d, f2)
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
# pdf_file= and png_file= write the figures, as lessR's pdf_file=
|
|
739
|
+
ANOVA = file_output(ANOVA)
|