1
我在R中有以下数据集,我想在散点图中绘制。R scatterplot,传说中没有显示
user distance time
1 1 8.559737 4
2 1 5.013872 5
3 1 11.168995 9
4 1 4.059428 4
5 1 3.928071 4
6 1 12.403195 7
我使用以下R代码生成我的图。
plot <- ggplot(scatter, aes(x=scatter[['distance']], y=scatter[['time']])) +
geom_point(shape=16, size=5, colour=scatter[['user']]) +
scale_x_continuous("Distance", limits=c(0,100), breaks=seq(0, 100, 10)) +
scale_y_continuous("Time", limits=c(0,20), breaks=seq(0, 20, 2))
png(filename="scatters/0_2_scatter.png", width=800, height=800)
plot(plot)
dev.off()
这会产生以下结果。
为什么我的图例不显示? geom_point中没有定义颜色是否足够? 我正在尝试生成一个包含黑点和文本'user1'的图例。