我假设您打算在示例中写plot(status, value)?无论如何,使用这些数据不会有太大的差异,但您应该通过以下示例了解可能需要查看的内容...
你看过jitter吗?
一些基础知识:
plot(jitter(status), value)
或者plot(jitter(status, 0.5), value)
拥有ggplot2 套餐的鸽友你可以这样做:
library(ggplot2)
df <- data.frame(value, status)
ggplot(data=df, aes(jitter(status, 0.10), value)) +
geom_point(alpha = 0.5)
或者这个……
ggplot(data=df, aes(factor(status), value)) +
geom_violin()
或者……
ggplot(data=df, aes(x=status, y=value)) +
geom_density2d() +
scale_x_continuous(limits=c(-1,2))
或者...
ggplot(data=df, aes(x=status, y=value)) +
geom_density2d() +
stat_density2d(geom="tile", aes(fill = ..density..), contour=FALSE) +
scale_x_continuous(limits=c(-1,2))
甚至这个..
ggplot(data=df, aes(fill=factor(status), value)) +
geom_density(alpha=0.2)