我想以灰色绘制5个密度的图(以打印我的图),这些密度非常接近。另外,如果我只是修改行的类型,还不清楚。因此,我想修改积分的类型。有人有解决办法吗?
目前,我将其绘制为:
# An example of data
df = data.frame(speed = c(80 + rnorm(n = 10, sd = 7),
100 + rnorm(n = 10, sd = 7),
90 + rnorm(n = 10, sd = 7)),
vehicule = c(rep("bus",10), rep("moto",10), rep("car",10)))
# Graph with different types of lines but not different types of points
ggplot(df, aes(speed, linetype = vehicule)) +
geom_density(alpha = 0.4)
或:
# Graph with different type of points but not density
ggplot(df, aes(speed, y = vehicule, linetype = vehicule)) +
geom_point(aes(shape=vehicule)) +
geom_density(alpha = 0.4) +
scale_color_grey() +
scale_fill_grey()