代码会创建一个比较延迟时间和各种航班目的地的条形图,但我必须改变它以使其按升序排列。我不确定是否使用order(),reorder()等。
tapply(df.delays$Delay,df.delays$Destination, sum)
totaldelay<-tapply(df.delays$Delay,df.delays$Destination, sum)
barplot(totaldelay, main="Total Delay Destination", xlab="Destination",ylab="Total Delay Time", ylim=c(0,25000))
答案 0 :(得分:0)
试试这个(barplot的例子):
require(grDevices) # for colours
tN <- table(Ni <- stats::rpois(100, lambda = 5))
r <- barplot(tN, col = rainbow(20))
#- type = "h" plotting *is* 'bar'plot
lines(r, tN, type = "h", col = "red", lwd = 2)
barplot(sort(tN), space = 1.5, axisnames = FALSE,
sub = "barplot(..., space= 1.5, axisnames = FALSE)")