Add VT2-examples: all 6 chapters of 'Visualize This' (110 files) — data scraping, ETL, trends, categorical, multivariate, spatial, distribution analysis

This commit is contained in:
neo committed 2026-06-24 14:49:15 +05:00
1 parent 088771a9cf
commit b42b866a8c
110 files changed
+400895

No files matched your search

@@ -0,0 +1,27 @@
#
# Pie charts
#
# Load data
htypes <- read.csv("data/household-types.tsv", sep="\t")
h2021 <- htypes[htypes$year == 2021,]
h2021_alpha <- h2021[order(h2021$htype, decreasing=TRUE),]
h2021_num <- h2021[order(h2021$p),]
#
# Pie chart, sorted and unsorted
#
par(mfrow=c(1,2))
pie(h2021_alpha$p, labels=h2021_alpha$htype, init.angle=90, col = "gray")
pie(h2021_num$p, labels=h2021_num$htype, init.angle=90, col = "gray")
#
# Bar chart, sorted and unsorted
#
par(mfrow=c(1,2))
barplot(h2021_alpha$p, names.arg=h2021_alpha$htype, horiz=TRUE)
barplot(h2021_num$p, names.arg=h2021_num$htype, horiz=TRUE)