Skip to content

Commit b517196

Browse files
committed
update example figure for readme
1 parent 60e0c3c commit b517196

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

docs/examples/example.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# %%
2+
from matplotlib import pyplot
3+
from scipy import stats
4+
import probscale # nothing else needed
5+
6+
beta = stats.beta(a=3, b=4)
7+
weibull = stats.weibull_min(c=5)
8+
scales = [
9+
{"scale": {"value": "linear"}, "label": "Linear (built-in)"},
10+
{"scale": {"value": "log", "base": 10}, "label": "Log. Base 10 (built-in)"},
11+
{"scale": {"value": "log", "base": 2}, "label": "Log. Base 2 (built-in)"},
12+
{"scale": {"value": "logit"}, "label": "Logit (built-in)"},
13+
{"scale": {"value": "prob"}, "label": "Standard Normal Probability (this package)"},
14+
{"scale": {"value": "prob", "dist": weibull}, "label": "Weibull probability scale, c=5 (this package)"},
15+
{"scale": {"value": "prob", "dist": beta}, "label": "Beta probability scale, α=3 & β=4 (this package)"},
16+
]
17+
18+
N = len(scales)
19+
fig, axes = pyplot.subplots(nrows=N, figsize=(9, N-1), constrained_layout=True)
20+
for scale, ax in zip(scales, axes.flat):
21+
ax.set_xscale(**scale["scale"])
22+
ax.text(0.0, 0.1, scale["label"] + " →", transform=ax.transAxes)
23+
ax.set_xlim(left=0.5, right=99.5)
24+
ax.set_yticks([])
25+
ax.spines.left.set_visible(False)
26+
ax.spines.right.set_visible(False)
27+
ax.spines.top.set_visible(False)
28+
29+
fig.savefig("../img/example.png", dpi=300)

docs/img/example.png

166 KB
Loading

0 commit comments

Comments
 (0)