- 已编辑
Liechi 在你基础上改了一下:
library(ggplot2)
library(magrittr)
expand.grid(x =seq(0.1, 10, by = 0.1), z = 1:4) %>%
transform(y = z/x, z = factor(z)) %>%
ggplot() +
geom_line(aes(x, y, color = z))
无管道版:
library(ggplot2)
ggplot(
transform(
expand.grid(
x = seq(0.1, 10, by = 0.1),
z = 1:4),
y = z / x,
z = factor(z))) +
geom_line(aes(x, y, color = z))