@@ -41,7 +41,8 @@ import xarray as xr
41
41
``` {code-cell} ipython3
42
42
%config InlineBackend.figure_format = 'retina'
43
43
az.style.use("arviz-darkgrid")
44
- plt.rcParams["figure.figsize"] = [12, 6]
44
+ figsize = [12, 4]
45
+ plt.rcParams["figure.figsize"] = figsize
45
46
rng = np.random.default_rng(1234)
46
47
```
47
48
@@ -81,7 +82,8 @@ display(data)
81
82
And we can visualise this as below.
82
83
83
84
``` {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);
85
87
```
86
88
87
89
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.
417
419
``` {code-cell} ipython3
418
420
:tags: [hide-input]
419
421
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 )
421
423
ax[0].set(
422
424
title="Model 2 suggests negative slopes for each group", xlabel=r"$\beta_1$", ylabel="Group"
423
425
);
@@ -628,10 +630,8 @@ The panel on the right shows the group level posterior of the slope and intercep
628
630
``` {code-cell} ipython3
629
631
:tags: [hide-input]
630
632
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");
635
635
```
636
636
637
637
## Summary
0 commit comments