Skip to content

Commit b93c161

Browse files
committed
tweak plot sizes
1 parent 8403f14 commit b93c161

File tree

2 files changed

+189
-189
lines changed

2 files changed

+189
-189
lines changed

examples/generalized_linear_models/GLM-simpsons-paradox.ipynb

Lines changed: 182 additions & 182 deletions
Large diffs are not rendered by default.

examples/generalized_linear_models/GLM-simpsons-paradox.myst.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ import xarray as xr
4141
```{code-cell} ipython3
4242
%config InlineBackend.figure_format = 'retina'
4343
az.style.use("arviz-darkgrid")
44-
plt.rcParams["figure.figsize"] = [12, 6]
44+
figsize = [12, 4]
45+
plt.rcParams["figure.figsize"] = figsize
4546
rng = np.random.default_rng(1234)
4647
```
4748

@@ -81,7 +82,8 @@ display(data)
8182
And we can visualise this as below.
8283

8384
```{code-cell} ipython3
84-
sns.scatterplot(data=data, x="x", y="y", hue="group");
85+
fig, ax = plt.subplots(figsize=(8, 6))
86+
sns.scatterplot(data=data, x="x", y="y", hue="group", ax=ax);
8587
```
8688

8789
The rest of the notebook will cover different ways that we can analyse this data using linear models.
@@ -417,7 +419,7 @@ The plot below takes a closer look at the group level slope parameters.
417419
```{code-cell} ipython3
418420
:tags: [hide-input]
419421
420-
ax = az.plot_forest(idata2.posterior["β1"], combined=True, figsize=(12, 4))
422+
ax = az.plot_forest(idata2.posterior["β1"], combined=True, figsize=figsize)
421423
ax[0].set(
422424
title="Model 2 suggests negative slopes for each group", xlabel=r"$\beta_1$", ylabel="Group"
423425
);
@@ -628,10 +630,8 @@ The panel on the right shows the group level posterior of the slope and intercep
628630
```{code-cell} ipython3
629631
:tags: [hide-input]
630632
631-
az.plot_forest(idata2.posterior["β1"], combined=True)
632-
ax[0].set(
633-
title="Model 3 suggests negative slopes for each group", xlabel=r"$\beta_1$", ylabel="Group"
634-
);
633+
ax = az.plot_forest(idata2.posterior["β1"], combined=True, figsize=figsize)[0]
634+
ax.set(title="Model 3 suggests negative slopes for each group", xlabel=r"$\beta_1$", ylabel="Group");
635635
```
636636

637637
## Summary

0 commit comments

Comments
 (0)