Skip to content

Commit 26eb920

Browse files
Merge pull request #228 from UBC-DSCI/main
Fix build warnings
2 parents cbfd430 + 44a1ab5 commit 26eb920

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

source/inference.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,27 +1122,26 @@ the true sampling distribution—which corresponds to taking many samples fr
11221122
```{code-cell} ipython3
11231123
:tags: [remove-input]
11241124
1125+
sampling_distribution.encoding.x['bin']['extent'] = (90, 250)
11251126
alt.vconcat(
11261127
alt.layer(
11271128
sampling_distribution,
1128-
sampling_distribution.mark_rule(color='#f58518', size=2).encode(x='mean(mean_price)', y=alt.Y()),
1129-
sampling_distribution.mark_text(color='#f58518', size=12, align='left', dx=16, fontWeight='bold').encode(
1129+
alt.Chart(sample_estimates).mark_rule(color='#f58518', size=2).encode(x='mean(mean_price)'),
1130+
alt.Chart(sample_estimates).mark_text(color='#f58518', size=12, align='left', dx=16, fontWeight='bold').encode(
11301131
x='mean(mean_price)',
11311132
y=alt.value(7),
11321133
text=alt.value(f"Mean = {sampling_distribution['data']['mean_price'].mean().round(1)}")
11331134
)
11341135
).properties(title='Sampling distribution', height=150),
11351136
alt.layer(
11361137
boot_est_dist,
1137-
boot_est_dist.mark_rule(color='#f58518', size=2).encode(x='mean(mean_price)', y=alt.Y()),
1138-
boot_est_dist.mark_text(color='#f58518', size=12, align='left', dx=18, fontWeight='bold').encode(
1138+
alt.Chart(boot20000_means).mark_rule(color='#f58518', size=2).encode(x='mean(mean_price)'),
1139+
alt.Chart(boot20000_means).mark_text(color='#f58518', size=12, align='left', dx=18, fontWeight='bold').encode(
11391140
x='mean(mean_price)',
1140-
y=alt.value(6),
1141+
y=alt.value(7),
11411142
text=alt.value(f"Mean = {boot_est_dist['data']['mean_price'].mean().round(1)}")
11421143
)
11431144
).properties(title='Bootstrap distribution', height=150)
1144-
).resolve_scale(
1145-
x='shared'
11461145
)
11471146
```
11481147

@@ -1252,18 +1251,19 @@ visualize the interval on our distribution in {numref}`fig:11-bootstrapping9`.
12521251

12531252
```{code-cell} ipython3
12541253
# Create the annotation for for the 2.5th percentile
1255-
text_025 = alt.Chart().mark_text(
1254+
rule_025 = alt.Chart().mark_rule(color='#f58518', size=3, strokeDash=[5]).encode(
1255+
x=alt.datum(ci_bounds[0.025])
1256+
).properties(
1257+
width=500
1258+
)
1259+
text_025 = rule_025.mark_text(
12561260
color='#f58518',
12571261
size=12,
12581262
fontWeight='bold',
12591263
dy=-160
12601264
).encode(
1261-
x=alt.datum(ci_bounds[0.025]),
12621265
text=alt.datum(f'2.5th percentile ({ci_bounds[0.025].round(1)})')
1263-
).properties(
1264-
width=500
12651266
)
1266-
rule_025 = text_025.mark_rule(color='#f58518', size=3, strokeDash=[5])
12671267
12681268
# Create the annotation for for the 97.5th percentile
12691269
text_975 = text_025.encode(

source/viz.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,13 +1554,14 @@ We also reduce the height of each chart
15541554
so that they all fit in the same view.
15551555
Note that we are re-using the chart we created just above,
15561556
instead of re-creating the same chart from scratch.
1557+
We also explicitly specify that `facet` is a categorical variable
1558+
since faceting should only be done with categorical variables.
15571559

15581560
```{code-cell} ipython3
1559-
15601561
morley_hist_facet = morley_hist_categorical.properties(
15611562
height=100
15621563
).facet(
1563-
"Expt",
1564+
"Expt:N",
15641565
columns=1
15651566
)
15661567
```
@@ -1626,7 +1627,7 @@ v_line = alt.Chart(morley_df).mark_rule(strokeDash=[5], size=2).encode(
16261627
morley_hist_relative = (morley_hist_rel + v_line).properties(
16271628
height=100
16281629
).facet(
1629-
"Expt",
1630+
"Expt:N",
16301631
columns=1,
16311632
title="Histogram of relative error of Michelson’s speed of light data"
16321633
)
@@ -1719,7 +1720,7 @@ morley_hist_default = alt.Chart(morley_df).mark_bar().encode(
17191720
morley_hist_max_bins = alt.vconcat(
17201721
alt.hconcat(
17211722
(morley_hist_default + v_line).facet(
1722-
'Expt',
1723+
'Expt:N',
17231724
columns=1,
17241725
title=alt.TitleParams('Default (bin=True)', fontSize=16, anchor='middle', dx=15)
17251726
),
@@ -1730,7 +1731,7 @@ morley_hist_max_bins = alt.vconcat(
17301731
title="Relative error (%)"
17311732
)
17321733
) + v_line).facet(
1733-
'Expt',
1734+
'Expt:N',
17341735
columns=1,
17351736
title=alt.TitleParams('maxbins=5', fontSize=16, anchor='middle', dx=15)
17361737
),
@@ -1743,7 +1744,7 @@ morley_hist_max_bins = alt.vconcat(
17431744
title="Relative error (%)"
17441745
)
17451746
) + v_line).facet(
1746-
'Expt',
1747+
'Expt:N',
17471748
columns=1,
17481749
title=alt.TitleParams('maxbins=70', fontSize=16, anchor='middle', dx=15)
17491750
),
@@ -1754,7 +1755,7 @@ morley_hist_max_bins = alt.vconcat(
17541755
title="Relative error (%)"
17551756
)
17561757
) + v_line).facet(
1757-
'Expt',
1758+
'Expt:N',
17581759
columns=1,
17591760
title=alt.TitleParams('maxbins=200', fontSize=16, anchor='middle', dx=15)
17601761
)

0 commit comments

Comments
 (0)