Für Vorlesungen, bitte die Webseite verwenden. https://flavigny.de/lecture
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
619B

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