|
- library(ggplot2)
- library(tibble)
-
- x_plt <- seq(0, 1, len=7)
- tb <- tibble(
- x_val = rep(x_plt, times=3),
- y_val = c(sin(2*pi*x_plt)/2+0.5, x_plt^2, sqrt(x_plt)),
- fun = rep(c("sin", "sqr", "sqrt"), each=length(x_plt)))
- tb$z_val = abs(0.5-tb$x_val)+0.1
-
- plt <- ggplot(data = tb, mapping = aes(x = x_val, y = y_val, color=fun)) +
- geom_line(mapping = aes(linetype=fun), size = 1.2) +
- geom_point(color = "black", mapping = aes(size = z_val))
-
- print(plt)
|