@@ -791,21 +791,18 @@ large enough sample.
791
791
792
792
# plot sample distributions for n = 10, 20, 50, 100, 200 and population distribution
793
793
sample_distribution_dict = {}
794
- np.random.seed(12)
795
794
for sample_n in [10, 20, 50, 100, 200]:
796
795
sample = airbnb.sample(sample_n)
797
796
sample_distribution_dict[f"sample_distribution_{sample_n}"] = (
798
- alt.Chart(sample, title=f"n = {sample_n}")
799
- .mark_bar()
800
- .encode(
797
+ alt.Chart(sample, title=f"n = {sample_n}").mark_bar().encode(
801
798
x=alt.X(
802
799
"price",
803
800
bin=alt.Bin(extent=[0, 600], step=20),
804
801
title="Price per night (Canadian dollars)",
805
802
),
806
803
y=alt.Y("count()", title="Count"),
807
804
)
808
- ).properties(width=350, height=150)
805
+ ).properties(height=150)
809
806
# add title and standardize the x axis ticks for population histogram
810
807
population_distribution.title = "Population distribution"
811
808
population_distribution.encoding["x"]["bin"] = alt.Bin(extent=[0, 600], step=20)
@@ -986,19 +983,16 @@ Let's take a look at histograms of the first six replicates of our bootstrap sam
986
983
:tags: []
987
984
988
985
six_bootstrap_samples = boot20000.query("replicate < 6")
989
-
990
- (
991
- alt.Chart(six_bootstrap_samples)
992
- .mark_bar()
993
- .encode(
994
- x=alt.X(
995
- "price",
996
- bin=alt.Bin(maxbins=20),
997
- title="Price per night (Canadian dollars)",
998
- ),
999
- y=alt.Y("count()", title="Count"),
1000
- ).properties(width=250, height=200)
1001
- .facet("replicate", columns=3)
986
+ alt.Chart(six_bootstrap_samples, height=150).mark_bar().encode(
987
+ x=alt.X(
988
+ "price",
989
+ bin=alt.Bin(maxbins=20),
990
+ title="Price per night (Canadian dollars)",
991
+ ),
992
+ y=alt.Y("count()", title="Count")
993
+ ).facet(
994
+ "replicate",
995
+ columns=2
1002
996
)
1003
997
```
1004
998
0 commit comments