library(ggplot2) library(tibble) x_plt <- seq(0, pi/2, len=100) tb <- tibble( x_val = rep(x_plt, 2), y_val = c(sin(x_plt), sin(2*x_plt)), fun = rep(c("sin(x)", "sin(2x)"), each=length(x_plt))) plt <- ggplot(tb, aes(x_val, y_val, color=fun)) + xlab("x") + ylab("y") + labs(color = "function") + scale_x_continuous(breaks = pi/c(Inf, 6, 4, 3, 2), labels = c("0", "pi/6", "pi/4", "pi/3", "pi/2")) + scale_y_continuous(breaks = sqrt(0:4/4), labels = c("0", "1/2", "sqrt(2)/2", "sqrt(3)/2", "1")) + geom_line() print(plt)