R圆形轮图

时间:2016-08-05 22:05:32

标签: r charts continuous

我试图制作一个有戒指的轮盘图。我的结果看起来像是在返回到下一个点之前所有行都返回到零。这是一个谨慎/连续的问题吗?我试过让Lap.Time和Lap数字无效:

f1 <- read.csv("F1 2011 Turkey - Fuel Corrected Lap Times.csv", header = T)

str(f1)
# data.frame:   1263 obs. of  5 variables:
#  $ Driver                               : Factor w/ 23 levels "1","2","3","4",..: 23 23 23 23 23 23 23 23 23 23 ...
#  $ Lap                                  : int  1 2 3 4 5 6 7 8 9 10 ...
#  $ Lap.Time                             : num  107 99.3 98.4 97.5 97.4 ...
#  $ Fuel.Adjusted.Laptime                : num  102.3 94.7 93.9 93.1 93.1 ...
#  $ Fuel.and.fastest.lap.adjusted.laptime: num  9.73 2.124 1.321 0.54 0.467 ...

library(ggplot2)

f1$Driver<-as.factor(f1$Driver)

p1 <- ggplot(data=subset(f1, Lap.Time <= 120), aes(x = Lap, y= Lap.Time, colour = Driver)) + 
         geom_point(aes(colour=Driver))

p2 <- ggplot(subset(f1, Lap.Time <= 120), 
             aes(x = Lap, y= Lap.Time, colour = Driver, group = 1)) + 
  geom_line(aes(colour=Driver)) 

pout <- p1 + coord_polar() 

pout2 <- p2  + coord_polar()
pout
pout2 

resulting chart image 所有数据都在这个csv中: https://docs.google.com/spreadsheets/d/1Ef2ewd1-0FM1mJL1o00C6c2gf7HFmanJh8an1EaAq2Q/edit?hl=en_GB&authkey=CMSemOQK#gid=0

csv示例:

Driver,Lap,Lap Time,Fuel Adjusted Laptime,Fuel and fastest lap adjusted laptime
25,1,106.951,102.334,9.73
25,2,99.264,94.728,2.124
25,3,98.38,93.925,1.321
25,4,97.518,93.144,0.54
25,5,97.364,93.071,0.467
25,6,97.853,93.641,1.037
25,7,98.381,94.25,1.646
25,8,98.142,94.092,1.488
25,9,97.585,93.616,1.012
25,10,97.567,93.679,1.075
25,11,97.566,93.759,1.155
25,12,97.771,94.045,1.441
25,13,98.532,94.887,2.283
25,14,99.146,95.582,2.978
25,15,98.529,95.046,2.442
25,16,99.419,96.017,3.413
25,17,114.593,111.272,18.668

0 个答案:

没有答案