library(ggplot2)
beta <- seq(-0.2, 0.2, by = 0.001)
exp_minus_1 <- exp(beta) - 1
(plot_pct_change_appxoimation <- ggplot() +
geom_line(
aes(x = beta, y = beta, color = "approx"),
linewidth = 2
) +
geom_line(
aes(x = beta, y = exp_minus_1, color = "exact"),
linewidth = 2
) +
scale_color_manual(
values = c("exact" = "#3B3B9A", "approx" = "#FFA500"),
labels = c(
"exact" = "exp(beta) - 1",
"approx" = "beta"
)
) +
labs(
x = "beta",
y = "% Change in $Y$",
color = NULL
) +
kfbmisc::theme_kyle(base_size = 18) +
theme(
legend.position = "top",
legend.margin = margin(0, 0, 5, 0),
legend.justification = c(0, 1),
legend.location = "plot"
)
)
Created on 2024-10-04 with reprex v2.1.0