Module # 11 assignment
Issaiah. Jennings
Module # 11 assignment
For this assignment, I recreated a classic Tufte-style dot-dash plot using ggplot2 in R. I started with a dataset that shows yearly values from 1967 to 1977. Using ggplot2, I made a clean line graph with dots showing the exact values for each year. I also added dashed horizontal lines to highlight important thresholds at 5 and 6, which matches the minimalist, data-focused style Tufte is known for. I customized the y-axis to show dollar values and used serif fonts and annotations to keep the design simple and clear.
# Load required libraries
library(ggplot2)
# Data
x <- 1967:1977
y <- c(0.5, 1.8, 4.6, 5.3, 5.3, 5.7, 5.4, 5, 5.5, 6, 5)
df <- data.frame(Year = x, Value = y)
# Plot
ggplot(df, aes(x = Year, y = Value)) +
geom_line(color = "black") +
geom_point(size = 3) +
geom_hline(yintercept = 5, linetype = "dashed") +
geom_hline(yintercept = 6, linetype = "dashed") +
annotate("text", x = max(df$Year), y = min(df$Value)*2.5,
label = "Per capita\nbudget expenditures\nin constant dollars",
hjust = 1, family = "serif", size = 4) +
annotate("text", x = max(df$Year), y = max(df$Value)/1.08,
label = "5%", family = "serif", size = 4) +
scale_y_continuous(
breaks = seq(1, 6, 1),
labels = sprintf("$%s", seq(300, 400, 20))
) +
theme_minimal(base_family = "serif") +
theme(
axis.title = element_blank(),
axis.ticks = element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major.x = element_blank(),
axis.text.x = element_text(size = 10),
axis.text.y = element_text(size = 10)
)

Comments
Post a Comment