-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathexample.py
38 lines (34 loc) · 1.34 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# %%
from pathlib import Path
from matplotlib import pyplot
from scipy import stats
import probscale # nothing else needed
beta = stats.beta(a=3, b=4)
weibull = stats.weibull_min(c=5)
scales = [
{"scale": {"value": "linear"}, "label": "Linear (built-in)"},
{"scale": {"value": "log", "base": 10}, "label": "Log. Base 10 (built-in)"},
{"scale": {"value": "log", "base": 2}, "label": "Log. Base 2 (built-in)"},
{"scale": {"value": "logit"}, "label": "Logit (built-in)"},
{"scale": {"value": "prob"}, "label": "Standard Normal Probability (this package)"},
{
"scale": {"value": "prob", "dist": weibull},
"label": "Weibull probability scale, c=5 (this package)",
},
{
"scale": {"value": "prob", "dist": beta},
"label": "Beta probability scale, α=3 & β=4 (this package)",
},
]
N = len(scales)
fig, axes = pyplot.subplots(nrows=N, figsize=(9, N - 1), constrained_layout=True)
for scale, ax in zip(scales, axes.flat):
ax.set_xscale(**scale["scale"])
ax.text(0.0, 0.1, scale["label"] + " →", transform=ax.transAxes)
ax.set_xlim(left=0.5, right=99.5)
ax.set_yticks([])
ax.spines.left.set_visible(False)
ax.spines.right.set_visible(False)
ax.spines.top.set_visible(False)
outpath = Path(__file__).parent.joinpath("../img/example.png").resolve()
fig.savefig(outpath, dpi=300)