Sebastian Vettel → Red Bull 281 pointsFernando Alonso → Ferrari 278 pointsKimi Rikknen → Lotus F1 207 pointsLewis Hamilton → McLaren 190 pointsJenson Button → McLaren 188 pointsMark Webber → Red Bull 179 pointsFelipe Massa → Ferrari 122 pointsRomain Grosjean → Lotus F1 96 pointsNico Rosberg → Mercedes 93 pointsSergio Prez → Sauber 66 pointsNico Hlkenberg → Force India 63 pointsKamui Kobayashi → Sauber 60 pointsMichael Schumacher → Mercedes 49 pointsPaul di Resta → Force India 46 pointsPastor Maldonado → Williams 45 pointsBruno Senna → Williams 31 pointsAustralian Grand Prix → Jenson Button 25 pointsMalaysian Grand Prix → Fernando Alonso 25 pointsChinese Grand Prix → Nico Rosberg 25 pointsBahrain Grand Prix → Sebastian Vettel 25 pointsSpanish Grand Prix → Pastor Maldonado 25 pointsMonaco Grand Prix → Mark Webber 25 pointsCanadian Grand Prix → Lewis Hamilton 25 pointsEuropean Grand Prix → Fernando Alonso 25 pointsBritish Grand Prix → Mark Webber 25 pointsGerman Grand Prix → Fernando Alonso 25 pointsHungarian Grand Prix → Lewis Hamilton 25 pointsBelgian Grand Prix → Jenson Button 25 pointsItalian Grand Prix → Lewis Hamilton 25 pointsSingapore Grand Prix → Sebastian Vettel 25 pointsJapanese Grand Prix → Sebastian Vettel 25 pointsKorean Grand Prix → Sebastian Vettel 25 pointsIndian Grand Prix → Sebastian Vettel 25 pointsAbu Dhabi Grand Prix → Kimi Rikknen 25 pointsUnited States Grand Prix → Lewis Hamilton 25 pointsBrazilian Grand Prix → Jenson Button 25 pointsAustralian Grand Prix → Sebastian Vettel 18 pointsMalaysian Grand Prix → Sergio Prez 18 pointsChinese Grand Prix → Jenson Button 18 pointsBahrain Grand Prix → Kimi Rikknen 18 pointsSpanish Grand Prix → Fernando Alonso 18 pointsMonaco Grand Prix → Nico Rosberg 18 pointsCanadian Grand Prix → Romain Grosjean 18 pointsEuropean Grand Prix → Kimi Rikknen 18 pointsBritish Grand Prix → Fernando Alonso 18 pointsGerman Grand Prix → Jenson Button 18 pointsHungarian Grand Prix → Kimi Rikknen 18 pointsBelgian Grand Prix → Sebastian Vettel 18 pointsItalian Grand Prix → Sergio Prez 18 pointsSingapore Grand Prix → Jenson Button 18 pointsJapanese Grand Prix → Felipe Massa 18 pointsKorean Grand Prix → Mark Webber 18 pointsIndian Grand Prix → Fernando Alonso 18 pointsAbu Dhabi Grand Prix → Fernando Alonso 18 pointsUnited States Grand Prix → Sebastian Vettel 18 pointsBrazilian Grand Prix → Fernando Alonso 18 pointsJean-ric Vergne → Toro Rosso 16 pointsAustralian Grand Prix → Lewis Hamilton 15 pointsMalaysian Grand Prix → Lewis Hamilton 15 pointsChinese Grand Prix → Lewis Hamilton 15 pointsBahrain Grand Prix → Romain Grosjean 15 pointsSpanish Grand Prix → Kimi Rikknen 15 pointsMonaco Grand Prix → Fernando Alonso 15 pointsCanadian Grand Prix → Sergio Prez 15 pointsEuropean Grand Prix → Michael Schumacher 15 pointsBritish Grand Prix → Sebastian Vettel 15 pointsGerman Grand Prix → Kimi Rikknen 15 pointsHungarian Grand Prix → Romain Grosjean 15 pointsBelgian Grand Prix → Kimi Rikknen 15 pointsItalian Grand Prix → Fernando Alonso 15 pointsSingapore Grand Prix → Fernando Alonso 15 pointsJapanese Grand Prix → Kamui Kobayashi 15 pointsKorean Grand Prix → Fernando Alonso 15 pointsIndian Grand Prix → Mark Webber 15 pointsAbu Dhabi Grand Prix → Sebastian Vettel 15 pointsUnited States Grand Prix → Fernando Alonso 15 pointsBrazilian Grand Prix → Felipe Massa 15 pointsAustralian Grand Prix → Mark Webber 12 pointsMalaysian Grand Prix → Mark Webber 12 pointsChinese Grand Prix → Mark Webber 12 pointsBahrain Grand Prix → Mark Webber 12 pointsSpanish Grand Prix → Romain Grosjean 12 pointsMonaco Grand Prix → Sebastian Vettel 12 pointsCanadian Grand Prix → Sebastian Vettel 12 pointsEuropean Grand Prix → Mark Webber 12 pointsBritish Grand Prix → Felipe Massa 12 pointsGerman Grand Prix → Kamui Kobayashi 12 pointsHungarian Grand Prix → Sebastian Vettel 12 pointsBelgian Grand Prix → Nico Hlkenberg 12 pointsItalian Grand Prix → Felipe Massa 12 pointsSingapore Grand Prix → Paul di Resta 12 pointsJapanese Grand Prix → Jenson Button 12 pointsKorean Grand Prix → Felipe Massa 12 pointsIndian Grand Prix → Lewis Hamilton 12 pointsAbu Dhabi Grand Prix → Jenson Button 12 pointsUnited States Grand Prix → Felipe Massa 12 pointsBrazilian Grand Prix → Mark Webber 12 pointsAustralian Grand Prix → Fernando Alonso 10 pointsDaniel Ricciardo → Toro Rosso 10 pointsMalaysian Grand Prix → Kimi Rikknen 10 pointsChinese Grand Prix → Sebastian Vettel 10 pointsBahrain Grand Prix → Nico Rosberg 10 pointsSpanish Grand Prix → Kamui Kobayashi 10 pointsMonaco Grand Prix → Lewis Hamilton 10 pointsCanadian Grand Prix → Fernando Alonso 10 pointsEuropean Grand Prix → Nico Hlkenberg 10 pointsBritish Grand Prix → Kimi Rikknen 10 pointsGerman Grand Prix → Sebastian Vettel 10 pointsHungarian Grand Prix → Fernando Alonso 10 pointsBelgian Grand Prix → Felipe Massa 10 pointsItalian Grand Prix → Kimi Rikknen 10 pointsSingapore Grand Prix → Nico Rosberg 10 pointsJapanese Grand Prix → Lewis Hamilton 10 pointsKorean Grand Prix → Kimi Rikknen 10 pointsIndian Grand Prix → Jenson Button 10 pointsAbu Dhabi Grand Prix → Pastor Maldonado 10 pointsUnited States Grand Prix → Jenson Button 10 pointsBrazilian Grand Prix → Nico Hlkenberg 10 pointsAustralian Grand Prix → Kamui Kobayashi 8 pointsMalaysian Grand Prix → Bruno Senna 8 pointsChinese Grand Prix → Romain Grosjean 8 pointsBahrain Grand Prix → Paul di Resta 8 pointsSpanish Grand Prix → Sebastian Vettel 8 pointsMonaco Grand Prix → Felipe Massa 8 pointsCanadian Grand Prix → Nico Rosberg 8 pointsEuropean Grand Prix → Nico Rosberg 8 pointsBritish Grand Prix → Romain Grosjean 8 pointsGerman Grand Prix → Sergio Prez 8 pointsHungarian Grand Prix → Jenson Button 8 pointsBelgian Grand Prix → Mark Webber 8 pointsItalian Grand Prix → Michael Schumacher 8 pointsSingapore Grand Prix → Kimi Rikknen 8 pointsJapanese Grand Prix → Kimi Rikknen 8 pointsKorean Grand Prix → Nico Hlkenberg 8 pointsIndian Grand Prix → Felipe Massa 8 pointsAbu Dhabi Grand Prix → Kamui Kobayashi 8 pointsUnited States Grand Prix → Kimi Rikknen 8 pointsBrazilian Grand Prix → Sebastian Vettel 8 pointsAustralian Grand Prix → Kimi Rikknen 6 pointsMalaysian Grand Prix → Paul di Resta 6 pointsChinese Grand Prix → Bruno Senna 6 pointsBahrain Grand Prix → Fernando Alonso 6 pointsSpanish Grand Prix → Nico Rosberg 6 pointsMonaco Grand Prix → Paul di Resta 6 pointsCanadian Grand Prix → Mark Webber 6 pointsEuropean Grand Prix → Paul di Resta 6 pointsBritish Grand Prix → Michael Schumacher 6 pointsGerman Grand Prix → Michael Schumacher 6 pointsHungarian Grand Prix → Bruno Senna 6 pointsBelgian Grand Prix → Michael Schumacher 6 pointsItalian Grand Prix → Nico Rosberg 6 pointsSingapore Grand Prix → Romain Grosjean 6 pointsJapanese Grand Prix → Nico Hlkenberg 6 pointsKorean Grand Prix → Romain Grosjean 6 pointsIndian Grand Prix → Kimi Rikknen 6 pointsAbu Dhabi Grand Prix → Felipe Massa 6 pointsUnited States Grand Prix → Romain Grosjean 6 pointsBrazilian Grand Prix → Michael Schumacher 6 pointsAustralian Grand Prix → Sergio Prez 4 pointsMalaysian Grand Prix → Jean-ric Vergne 4 pointsChinese Grand Prix → Pastor Maldonado 4 pointsBahrain Grand Prix → Lewis Hamilton 4 pointsSpanish Grand Prix → Lewis Hamilton 4 pointsMonaco Grand Prix → Nico Hlkenberg 4 pointsCanadian Grand Prix → Kimi Rikknen 4 pointsEuropean Grand Prix → Jenson Button 4 pointsBritish Grand Prix → Lewis Hamilton 4 pointsGerman Grand Prix → Mark Webber 4 pointsHungarian Grand Prix → Mark Webber 4 pointsBelgian Grand Prix → Jean-ric Vergne 4 pointsItalian Grand Prix → Paul di Resta 4 pointsSingapore Grand Prix → Felipe Massa 4 pointsJapanese Grand Prix → Pastor Maldonado 4 pointsKorean Grand Prix → Jean-ric Vergne 4 pointsIndian Grand Prix → Nico Hlkenberg 4 pointsAbu Dhabi Grand Prix → Bruno Senna 4 pointsUnited States Grand Prix → Nico Hlkenberg 4 pointsBrazilian Grand Prix → Jean-ric Vergne 4 pointsAustralian Grand Prix → Daniel Ricciardo 2 pointsMalaysian Grand Prix → Nico Hlkenberg 2 pointsChinese Grand Prix → Fernando Alonso 2 pointsBahrain Grand Prix → Felipe Massa 2 pointsSpanish Grand Prix → Jenson Button 2 pointsMonaco Grand Prix → Kimi Rikknen 2 pointsCanadian Grand Prix → Kamui Kobayashi 2 pointsEuropean Grand Prix → Sergio Prez 2 pointsBritish Grand Prix → Bruno Senna 2 pointsGerman Grand Prix → Nico Hlkenberg 2 pointsHungarian Grand Prix → Felipe Massa 2 pointsBelgian Grand Prix → Daniel Ricciardo 2 pointsItalian Grand Prix → Kamui Kobayashi 2 pointsSingapore Grand Prix → Daniel Ricciardo 2 pointsJapanese Grand Prix → Mark Webber 2 pointsKorean Grand Prix → Daniel Ricciardo 2 pointsIndian Grand Prix → Romain Grosjean 2 pointsAbu Dhabi Grand Prix → Paul di Resta 2 pointsUnited States Grand Prix → Pastor Maldonado 2 pointsBrazilian Grand Prix → Kamui Kobayashi 2 pointsAustralian Grand Prix → Paul di Resta 1 pointsMalaysian Grand Prix → Michael Schumacher 1 pointsChinese Grand Prix → Kamui Kobayashi 1 pointsBahrain Grand Prix → Michael Schumacher 1 pointsSpanish Grand Prix → Nico Hlkenberg 1 pointsMonaco Grand Prix → Bruno Senna 1 pointsCanadian Grand Prix → Felipe Massa 1 pointsEuropean Grand Prix → Bruno Senna 1 pointsBritish Grand Prix → Jenson Button 1 pointsGerman Grand Prix → Nico Rosberg 1 pointsHungarian Grand Prix → Nico Rosberg 1 pointsBelgian Grand Prix → Paul di Resta 1 pointsItalian Grand Prix → Bruno Senna 1 pointsSingapore Grand Prix → Sergio Prez 1 pointsJapanese Grand Prix → Daniel Ricciardo 1 pointsKorean Grand Prix → Lewis Hamilton 1 pointsIndian Grand Prix → Bruno Senna 1 pointsAbu Dhabi Grand Prix → Daniel Ricciardo 1 pointsUnited States Grand Prix → Bruno Senna 1 pointsBrazilian Grand Prix → Kimi Rikknen 1 pointsAustralian Grand Prix 101 pointsAustralian Grand PrixJenson Button 188 pointsJenson ButtonSebastian Vettel 281 pointsSebastian VettelLewis Hamilton 190 pointsLewis HamiltonMark Webber 179 pointsMark WebberFernando Alonso 278 pointsFernando AlonsoKamui Kobayashi 60 pointsKamui KobayashiKimi Rikknen 207 pointsKimi RikknenSergio Prez 66 pointsSergio PrezDaniel Ricciardo 10 pointsDaniel RicciardoPaul di Resta 46 pointsPaul di RestaMcLaren 378 pointsMcLarenRed Bull 460 pointsRed BullFerrari 400 pointsFerrariSauber 126 pointsSauberLotus F1 303 pointsLotus F1Toro Rosso 26 pointsToro RossoForce India 109 pointsForce IndiaMalaysian Grand Prix 101 pointsMalaysian Grand PrixBruno Senna 31 pointsBruno SennaJean-ric Vergne 16 pointsJean-ric VergneNico Hlkenberg 63 pointsNico HlkenbergMichael Schumacher 49 pointsMichael SchumacherWilliams 76 pointsWilliamsMercedes 142 pointsMercedesChinese Grand Prix 101 pointsChinese Grand PrixNico Rosberg 93 pointsNico RosbergRomain Grosjean 96 pointsRomain GrosjeanPastor Maldonado 45 pointsPastor MaldonadoBahrain Grand Prix 101 pointsBahrain Grand PrixFelipe Massa 122 pointsFelipe MassaSpanish Grand Prix 101 pointsSpanish Grand PrixMonaco Grand Prix 101 pointsMonaco Grand PrixCanadian Grand Prix 101 pointsCanadian Grand PrixEuropean Grand Prix 101 pointsEuropean Grand PrixBritish Grand Prix 101 pointsBritish Grand PrixGerman Grand Prix 101 pointsGerman Grand PrixHungarian Grand Prix 101 pointsHungarian Grand PrixBelgian Grand Prix 101 pointsBelgian Grand PrixItalian Grand Prix 101 pointsItalian Grand PrixSingapore Grand Prix 101 pointsSingapore Grand PrixJapanese Grand Prix 101 pointsJapanese Grand PrixKorean Grand Prix 101 pointsKorean Grand PrixIndian Grand Prix 101 pointsIndian Grand PrixAbu Dhabi Grand Prix 101 pointsAbu Dhabi Grand PrixUnited States Grand Prix 101 pointsUnited States Grand PrixBrazilian Grand Prix 101 pointsBrazilian Grand Prix

  1. #another one from Tony Hirst
  2. #post at //blog.ouseful.info/2012/05/24/f1-championship-points-as-a-d3-js-powered-sankey-diagram/
  3. #data at https://views.scraperwiki.com/run/ergast_championship_nodelist/?
  4. #get source from original example
  5. #this is a JSON, so will need to translate
  6. #expect most data to come straight from R
  7. #in form of source, target, value
  8. links <- matrix(unlist(
  9. rjson::fromJSON(
  10. file = "https://views.scraperwiki.com/run/ergast_championship_nodelist/?"
  11. )$links
  12. ),ncol = 3, byrow = TRUE)
  13. nodes <- unlist(
  14. rjson::fromJSON(
  15. file = "https://views.scraperwiki.com/run/ergast_championship_nodelist/?"
  16. )$nodes
  17. )
  18. #nodes are 2 columns but in vector form
  19. #just get the name and ignore id
  20. nodes <- nodes[seq(1,length(nodes),by=2)]
  21. #convert to data.frame so souce and target can be character and value numeric
  22. links <- data.frame(links)
  23. colnames(links) <- c("source", "target", "value")
  24. links$source <- sapply(links$source, FUN = function(x) {return(as.character(nodes[x+1]))}) #x+1 since js starts at 0
  25. links$target <- sapply(links$target, FUN = function(x) {return(nodes[x+1])}) #x+1 since js starts at 0
  26. #now we finally have the data in the form we need
  27. sankeyPlot <- rCharts$new()
  28. sankeyPlot$setLib('.')
  29. sankeyPlot$setTemplate(script = "layouts/chart.html")
  30. sankeyPlot$set(
  31. data = links,
  32. nodeWidth = 15,
  33. nodePadding = 10,
  34. layout = 32,
  35. width = 700,
  36. height = 400,
  37. units = "points"
  38. )
  39. sankeyPlot