library(ggplot2)
library(kfbmisc)
x = seq(-pi, pi, 0.02)
df = data.frame(x = x, y = sin(x))
p = ggplot(df) +
geom_line(aes(x = x, y = y), linewidth = 1.5) +
labs(x = "$x$", y = "$\\sin(x)$") +
scale_x_continuous(
breaks = c(-pi, -2, 0, 2, pi),
labels = c("$-\\pi$", -2, 0, 2, "$\\pi$")
) +
theme_kyle(base_size = 12)
ggplot
-> tikzpicture
-> pdf
kfbmisc::tikzsave(
"sin.tex",
plot = p, width = 6, height = 4
)