我有以下csv文件:
class,quantity,time
mongoclientsmall,1000,29.6
mongoclientsmall,10000,236.3
mongoclientsmall,100000,2388.4
mongoclientsmall,200000,4766.7
mongoosesmall,1000,30.7
mongoosesmall,10000,232.2
mongoosesmall,100000,2342.6
mongoosesmall,200000,4744.9
mongoclientbig,1000,31.1
mongoclientbig,10000,238.5
mongoclientbig,100000,2404.4
mongoclientbig,200000,4795.5
mongoosebig,1000,30.8
mongoosebig,10000,239
mongoosebig,100000,2356.6
mongoosebig,200000,4721
这有四个类,但是当我使用以下命令绘图时,它显示了一条包含两行的绘图,为什么?
要绘制的命令:
difftime_update <- read.table("./difftime-update.csv", header=TRUE, sep=",")
ggplot(data=difftime_update, aes(x=quantity,y=time,group=class)) +
geom_line()
答案 0 :(得分:1)
尝试使用colour
而不是group
。
difftime_update %>%
ggplot(aes(x=quantity,y=time, colour=class)) +
geom_line()
这对我有用。