我对R很新,我对 ggplot2 库有疑问。我的数据框中有n列,我想在最终的情节中添加n行。这是情节:
globalPlot <-ggplot(allDataFrame,aes(x = seq(1,100,length=100)))+labs(x="Percentile",y="Response time[ms]",
title="Overall response time percentile chart",colour=NULL)
然后我用
添加数据for(col in colnames(allDataFrame)){
globalPlot <- globalPlot + geom_line(data=melt(allDataFrame[[col]]),aes(y=allDataFrame[[col]], colour=col))
}
一切似乎都没问题,但在打印的图表上我只能看到添加的最后一行。
dput(head(allDataFrame))
structure(list(POST...Sign.In = c(2230, 2282.72727272727, 2335.45454545455,
2388.18181818182, 2440.90909090909, 2493.63636363636),GET...companies.for.account = c(205,
205.545454545455, 206.090909090909, 206.636363636364, 207.181818181818,
207.727272727273), GET...all.announcements = c(715, 717.818181818182,
720.636363636364, 723.454545454545, 726.272727272727, 729.090909090909
), GET...announcement.details = c(294, 294.454545454545, 294.909090909091,
295.363636363636, 295.818181818182, 296.272727272727), POST...comment.to.last.viewed.announcement = c(441,
443.181818181818, 445.363636363636, 447.545454545455, 449.727272727273,
451.909090909091), GET...all.current.conversations = c(686, 689.636363636364,
693.272727272727, 696.909090909091, 700.545454545455, 704.181818181818
), GET...all.unread.conversations = c(777, 777.454545454545,
777.909090909091, 778.363636363636, 778.818181818182, 779.272727272727
), GET...users = c(516, 519.818181818182, 523.636363636364, 527.454545454545,
531.272727272727, 535.090909090909), POST...new.message.for.users = c(519,
519.888888888889, 520.777777777778, 521.666666666667, 522.555555555556,
523.444444444444), GET...user.s.profile = c(204, 204.080808080808,
204.161616161616, 204.242424242424, 204.323232323232, 204.40404040404
), GET...all.assigned.tasks = c(584, 648.484848484848, 712.969696969697,
777.454545454545, 841.939393939394, 906.424242424242), GET...all.assigned.tasks.not.in.progress = c(650,
656.333333333333, 662.666666666667, 669, 675.333333333333, 681.666666666667
), POST...change.status.to.in.progress = c(488, 492.121212121212,
496.242424242424, 500.363636363636, 504.484848484848, 508.606060606061
), POST...change.status.to.completed = c(3601, 3821.09090909091,
4041.18181818182, 4261.27272727273, 4481.36363636364, 4701.45454545455
), GET...all.new.tasks = c(527, 537.222222222222, 547.444444444444,
557.666666666667, 567.888888888889, 572.131313131313), GET...selected.task = c(332,
332.909090909091, 333.818181818182, 339.818181818182, 347.090909090909,
350.545454545455), GET...all.due.soon.tasks = c(640, 662.30303030303,
684.606060606061, 706.909090909091, 729.212121212121, 752), POST...comment.an.assigned.task = c(655,
664.181818181818, 673.363636363636, 682.545454545455, 691.727272727273,
700.909090909091)), .Names = c("POST...Sign.In", "GET...companies.for.account",
"GET...all.announcements", "GET...announcement.details", "POST...comment.to.last.viewed.announcement",
"GET...all.current.conversations", "GET...all.unread.conversations",
"GET...users", "POST...new.message.for.users", "GET...user.s.profile",
"GET...all.assigned.tasks", "GET...all.assigned.tasks.not.in.progress",
"POST...change.status.to.in.progress", "POST...change.status.to.completed",
"GET...all.new.tasks", "GET...selected.task", "GET...all.due.soon.tasks",
"POST...comment.an.assigned.task"), row.names = c(NA, 6L), class = "data.frame")