2

I'm trying to make a wheel chart that has rings. My result looks like the lines all go back to zero before continuing to the next point. Is it a discreet/continuous issue? I've tried making Lap.Time and Lap both numeric to no avail:

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 All the data is in this csv: https://docs.google.com/spreadsheets/d/1Ef2ewd1-0FM1mJL1o00C6c2gf7HFmanJh8an1EaAq2Q/edit?hl=en_GB&authkey=CMSemOQK#gid=0

Sample of 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
Machavity
  • 30,841
  • 27
  • 92
  • 100
Peter Nsanze
  • 69
  • 1
  • 11
  • Can you please add a small example dataset? What you have provided is not reproducible. – dayne Aug 05 '16 at 22:10
  • To provide your data sample, paste in the output of `dput(f1_sample)` rather than what you just pasted in. – eipi10 Aug 05 '16 at 22:35
  • Hum, I can't reproduce the resulting chart image by your code. `group = 1` is unnecessary, this is all I can tell you now. – cuttlefish44 Aug 06 '16 at 12:47
  • It seems like it is trying to draw one line for all the drivers. When I plot one driver alone I get a line from race to race as I would expect. Any advice on how to say "draw a distinct line for each driver"? – Peter Nsanze Aug 06 '16 at 13:30
  • It seems "group =1" in the ggplot for geom_line was the issue. Thanks for the responses. Glad I figured it out. SO is an amazing community! :-) – Peter Nsanze Aug 06 '16 at 13:36
  • I noticed why I can't reproduce it, because of using sample of csv. I'm happy to help you. – cuttlefish44 Aug 07 '16 at 05:25

0 Answers0