Skip to content

Instantly share code, notes, and snippets.

@nl-hugo
Last active July 24, 2018 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nl-hugo/04664e7efe84c399b2bc44cb0c3be0b1 to your computer and use it in GitHub Desktop.
Save nl-hugo/04664e7efe84c399b2bc44cb0c3be0b1 to your computer and use it in GitHub Desktop.
Formula One Fastest Laps 2004-2017
height: 650
license: MIT
scrolling: yes
border: no

A visualisation of fastest lap times for each Formula One race track from 2004 until 2017.

Closed circles are races under rainy conditions and they tend to produce slower lap speeds. Open circles have normal (or unknown) weather conditions. The circles that are slightly larger mark the fastest lap time for the circuit. Use your mouse to unveil drivers and lap times.

Data courtesy of Ergast, downloaded from Kaggle. Tables that are used in this viz are:

  • results.csv
  • races.csv
  • circuits.csv
  • drivers.csv

Data is merged in fastest_lap.csv and updated with weather info using the data.R script that I wrote for this block.

library(dplyr)
library(rvest)
results <- read.csv("results.csv", stringsAsFactors = FALSE)
races <- read.csv("races.csv", stringsAsFactors = FALSE)
circuits <- read.csv("circuits.csv", stringsAsFactors = FALSE)
drivers <- read.csv("drivers.csv", stringsAsFactors = FALSE)
# weather conditions
get_rain <- function(url) {
print(url)
res <- FALSE
tryCatch({
webpage <- read_html(url)
info <- html_nodes(webpage, ".infobox.vevent") %>% html_table(fill = TRUE) %>% .[[1]]
w = info[info[,1] == "Weather", 2]
res <- any(grepl("rain", w, ignore.case=TRUE))
}, error = function(e) {
print(e)
})
print(res)
return(res)
}
races <- races %>% filter(year >= 2004) %>% rowwise() %>% mutate(rain = get_rain(url))
results %>%
filter(!fastestLapTime == "") %>%
group_by(raceId) %>%
filter(fastestLapTime == min(fastestLapTime)) %>%
filter(fastestLapSpeed == max(fastestLapSpeed)) %>% # tie-braker
left_join(races, by = "raceId") %>%
left_join(circuits, by = "circuitId") %>%
left_join(drivers, by = "driverId") %>%
arrange(year, round) %>%
select(raceId, circuitId, year, round, name = name.x, circuit = name.y, rain, country, forename, surname, fastestLapTime, fastestLapSpeed) %>%
write.csv(., file = "fastest_lap.csv", row.names = FALSE, fileEncoding = "UTF-8")
raceId circuitId year round name circuit rain country forename surname fastestLapTime fastestLapSpeed
90 1 2004 1 Australian Grand Prix Albert Park Grand Prix Circuit FALSE Australia Michael Schumacher 01:24.1 226.933
91 2 2004 2 Malaysian Grand Prix Sepang International Circuit TRUE Malaysia Juan Pablo Montoya 01:34.2 211.782
92 3 2004 3 Bahrain Grand Prix Bahrain International Circuit FALSE Bahrain Michael Schumacher 01:30.3 216.074
93 21 2004 4 San Marino Grand Prix Autodromo Enzo e Dino Ferrari FALSE Italy Michael Schumacher 01:20.4 220.85
94 4 2004 5 Spanish Grand Prix Circuit de Barcelona-Catalunya FALSE Spain Michael Schumacher 01:17.5 215.07
95 6 2004 6 Monaco Grand Prix Circuit de Monaco FALSE Monaco Michael Schumacher 01:14.4 161.528
96 20 2004 7 European Grand Prix NÌ_rburgring FALSE Germany Michael Schumacher 01:29.5 207.144
97 7 2004 8 Canadian Grand Prix Circuit Gilles Villeneuve FALSE Canada Rubens Barrichello 01:13.6 213.246
98 19 2004 9 United States Grand Prix Indianapolis Motor Speedway FALSE USA Rubens Barrichello 01:10.4 214.366
99 8 2004 10 French Grand Prix Circuit de Nevers Magny-Cours FALSE France Michael Schumacher 01:15.4 210.669
100 9 2004 11 British Grand Prix Silverstone Circuit FALSE UK Michael Schumacher 01:18.7 235.049
101 10 2004 12 German Grand Prix Hockenheimring FALSE Germany Kimi RÌ_ikk̦nen 01:13.8 223.182
102 11 2004 13 Hungarian Grand Prix Hungaroring FALSE Hungary Michael Schumacher 01:19.1 199.461
103 13 2004 14 Belgian Grand Prix Circuit de Spa-Francorchamps FALSE Belgium Kimi RÌ_ikk̦nen 01:45.1 238.931
104 14 2004 15 Italian Grand Prix Autodromo Nazionale di Monza FALSE Italy Rubens Barrichello 01:21.0 257.32
105 17 2004 16 Chinese Grand Prix Shanghai International Circuit FALSE China Michael Schumacher 01:32.2 212.749
106 22 2004 17 Japanese Grand Prix Suzuka Circuit FALSE Japan Rubens Barrichello 01:32.7 225.441
107 18 2004 18 Brazilian Grand Prix AutÌ_dromo JosÌ© Carlos Pace FALSE Brazil Juan Pablo Montoya 01:11.5 217.038
71 1 2005 1 Australian Grand Prix Albert Park Grand Prix Circuit FALSE Australia Fernando Alonso 01:25.7 222.807
72 2 2005 2 Malaysian Grand Prix Sepang International Circuit FALSE Malaysia Kimi RÌ_ikk̦nen 01:35.5 208.987
73 3 2005 3 Bahrain Grand Prix Bahrain International Circuit FALSE Bahrain Pedro de la Rosa 01:31.4 213.054
74 21 2005 4 San Marino Grand Prix Autodromo Enzo e Dino Ferrari FALSE Italy Michael Schumacher 01:21.9 216.946
75 4 2005 5 Spanish Grand Prix Circuit de Barcelona-Catalunya FALSE Spain Giancarlo Fisichella 01:15.6 220.213
76 6 2005 6 Monaco Grand Prix Circuit de Monaco FALSE Monaco Michael Schumacher 01:15.8 158.54
77 20 2005 7 European Grand Prix NÌ_rburgring FALSE Germany Fernando Alonso 01:30.7 204.305
78 7 2005 8 Canadian Grand Prix Circuit Gilles Villeneuve FALSE Canada Kimi RÌ_ikk̦nen 01:14.4 211.061
79 19 2005 9 United States Grand Prix Indianapolis Motor Speedway FALSE USA Michael Schumacher 01:11.5 211.074
80 8 2005 10 French Grand Prix Circuit de Nevers Magny-Cours FALSE France Kimi RÌ_ikk̦nen 01:16.4 207.785
81 9 2005 11 British Grand Prix Silverstone Circuit FALSE UK Kimi RÌ_ikk̦nen 01:20.5 229.902
82 10 2005 12 German Grand Prix Hockenheimring FALSE Germany Kimi RÌ_ikk̦nen 01:14.9 219.924
83 11 2005 13 Hungarian Grand Prix Hungaroring FALSE Hungary Kimi RÌ_ikk̦nen 01:21.2 194.186
84 5 2005 14 Turkish Grand Prix Istanbul Park FALSE Turkey Juan Pablo Montoya 01:24.8 226.693
85 14 2005 15 Italian Grand Prix Autodromo Nazionale di Monza FALSE Italy Kimi RÌ_ikk̦nen 01:21.5 255.874
86 13 2005 16 Belgian Grand Prix Circuit de Spa-Francorchamps FALSE Belgium Ralf Schumacher 01:51.5 225.329
87 18 2005 17 Brazilian Grand Prix AutÌ_dromo JosÌ© Carlos Pace FALSE Brazil Kimi RÌ_ikk̦nen 01:12.3 214.651
88 22 2005 18 Japanese Grand Prix Suzuka Circuit FALSE Japan Kimi RÌ_ikk̦nen 01:31.5 228.372
89 17 2005 19 Chinese Grand Prix Shanghai International Circuit FALSE China Kimi RÌ_ikk̦nen 01:33.2 210.458
53 3 2006 1 Bahrain Grand Prix Bahrain International Circuit FALSE Bahrain Nico Rosberg 01:32.4 210.838
54 2 2006 2 Malaysian Grand Prix Sepang International Circuit FALSE Malaysia Fernando Alonso 01:34.8 210.487
55 1 2006 3 Australian Grand Prix Albert Park Grand Prix Circuit FALSE Australia Kimi RÌ_ikk̦nen 01:26.0 221.869
56 21 2006 4 San Marino Grand Prix Autodromo Enzo e Dino Ferrari FALSE Italy Fernando Alonso 01:24.6 211.098
57 20 2006 5 European Grand Prix NÌ_rburgring FALSE Germany Michael Schumacher 01:32.1 201.226
58 4 2006 6 Spanish Grand Prix Circuit de Barcelona-Catalunya FALSE Spain Felipe Massa 01:16.6 217.32
59 6 2006 7 Monaco Grand Prix Circuit de Monaco FALSE Monaco Michael Schumacher 01:15.1 160.014
60 9 2006 8 British Grand Prix Silverstone Circuit FALSE UK Fernando Alonso 01:21.6 226.811
61 7 2006 9 Canadian Grand Prix Circuit Gilles Villeneuve FALSE Canada Kimi RÌ_ikk̦nen 01:15.8 207.006
62 19 2006 10 United States Grand Prix Indianapolis Motor Speedway FALSE USA Michael Schumacher 01:12.7 207.527
63 8 2006 11 French Grand Prix Circuit de Nevers Magny-Cours FALSE France Michael Schumacher 01:17.1 205.931
64 10 2006 12 German Grand Prix Hockenheimring FALSE Germany Michael Schumacher 01:16.4 215.65
65 11 2006 13 Hungarian Grand Prix Hungaroring TRUE Hungary Felipe Massa 01:23.5 188.845
66 5 2006 14 Turkish Grand Prix Istanbul Park FALSE Turkey Michael Schumacher 01:28.0 218.36
67 14 2006 15 Italian Grand Prix Autodromo Nazionale di Monza FALSE Italy Kimi RÌ_ikk̦nen 01:22.6 252.604
68 17 2006 16 Chinese Grand Prix Shanghai International Circuit TRUE China Fernando Alonso 01:37.6 201.09
69 22 2006 17 Japanese Grand Prix Suzuka Circuit FALSE Japan Fernando Alonso 01:32.7 225.572
70 18 2006 18 Brazilian Grand Prix AutÌ_dromo JosÌ© Carlos Pace FALSE Brazil Michael Schumacher 01:12.2 214.966
36 1 2007 1 Australian Grand Prix Albert Park Grand Prix Circuit FALSE Australia Kimi RÌ_ikk̦nen 01:25.2 223.978
37 2 2007 2 Malaysian Grand Prix Sepang International Circuit FALSE Malaysia Lewis Hamilton 01:36.7 206.355
38 3 2007 3 Bahrain Grand Prix Bahrain International Circuit FALSE Bahrain Felipe Massa 01:34.1 207.12
39 4 2007 4 Spanish Grand Prix Circuit de Barcelona-Catalunya FALSE Spain Felipe Massa 01:22.7 202.685
40 6 2007 5 Monaco Grand Prix Circuit de Monaco FALSE Monaco Fernando Alonso 01:15.3 159.715
41 7 2007 6 Canadian Grand Prix Circuit Gilles Villeneuve FALSE Canada Fernando Alonso 01:16.4 205.58
42 19 2007 7 United States Grand Prix Indianapolis Motor Speedway FALSE USA Kimi RÌ_ikk̦nen 01:13.1 206.397
43 8 2007 8 French Grand Prix Circuit de Nevers Magny-Cours FALSE France Felipe Massa 01:16.1 208.67
44 9 2007 9 British Grand Prix Silverstone Circuit FALSE UK Kimi RÌ_ikk̦nen 01:20.6 229.514
45 20 2007 10 European Grand Prix NÌ_rburgring TRUE Germany Felipe Massa 01:32.9 199.592
46 11 2007 11 Hungarian Grand Prix Hungaroring FALSE Hungary Kimi RÌ_ikk̦nen 01:20.0 197.029
47 5 2007 12 Turkish Grand Prix Istanbul Park FALSE Turkey Kimi RÌ_ikk̦nen 01:27.3 220.136
48 14 2007 13 Italian Grand Prix Autodromo Nazionale di Monza FALSE Italy Fernando Alonso 01:22.9 251.653
49 13 2007 14 Belgian Grand Prix Circuit de Spa-Francorchamps FALSE Belgium Felipe Massa 01:48.0 233.388
50 16 2007 15 Japanese Grand Prix Fuji Speedway TRUE Japan Lewis Hamilton 01:28.2 186.259
51 17 2007 16 Chinese Grand Prix Shanghai International Circuit TRUE China Felipe Massa 01:37.5 201.362
52 18 2007 17 Brazilian Grand Prix AutÌ_dromo JosÌ© Carlos Pace FALSE Brazil Kimi RÌ_ikk̦nen 01:12.4 214.126
18 1 2008 1 Australian Grand Prix Albert Park Grand Prix Circuit FALSE Australia Heikki Kovalainen 01:27.4 218.385
19 2 2008 2 Malaysian Grand Prix Sepang International Circuit FALSE Malaysia Nick Heidfeld 01:35.4 209.244
20 3 2008 3 Bahrain Grand Prix Bahrain International Circuit FALSE Bahrain Heikki Kovalainen 01:33.2 209.062
21 4 2008 4 Spanish Grand Prix Circuit de Barcelona-Catalunya FALSE Spain Kimi RÌ_ikk̦nen 01:21.7 205.191
22 5 2008 5 Turkish Grand Prix Istanbul Park FALSE Turkey Kimi RÌ_ikk̦nen 01:26.5 222.144
23 6 2008 6 Monaco Grand Prix Circuit de Monaco FALSE Monaco Kimi RÌ_ikk̦nen 01:16.7 156.789
24 7 2008 7 Canadian Grand Prix Circuit Gilles Villeneuve FALSE Canada Kimi RÌ_ikk̦nen 01:17.4 202.871
25 8 2008 8 French Grand Prix Circuit de Nevers Magny-Cours TRUE France Kimi RÌ_ikk̦nen 01:16.6 207.224
26 9 2008 9 British Grand Prix Silverstone Circuit TRUE UK Kimi RÌ_ikk̦nen 01:32.1 200.842
27 10 2008 10 German Grand Prix Hockenheimring FALSE Germany Nick Heidfeld 01:16.0 216.7
28 11 2008 11 Hungarian Grand Prix Hungaroring FALSE Hungary Kimi RÌ_ikk̦nen 01:21.2 194.243
29 12 2008 12 European Grand Prix Valencia Street Circuit FALSE Spain Felipe Massa 01:38.7 197.637
30 13 2008 13 Belgian Grand Prix Circuit de Spa-Francorchamps TRUE Belgium Kimi RÌ_ikk̦nen 01:47.9 233.618
31 14 2008 14 Italian Grand Prix Autodromo Nazionale di Monza TRUE Italy Kimi RÌ_ikk̦nen 01:28.0 236.859
32 15 2008 15 Singapore Grand Prix Marina Bay Street Circuit FALSE Singapore Kimi RÌ_ikk̦nen 01:45.6 172.74
33 16 2008 16 Japanese Grand Prix Fuji Speedway FALSE Japan Felipe Massa 01:18.4 209.456
34 17 2008 17 Chinese Grand Prix Shanghai International Circuit FALSE China Lewis Hamilton 01:36.3 203.722
35 18 2008 18 Brazilian Grand Prix AutÌ_dromo JosÌ© Carlos Pace TRUE Brazil Felipe Massa 01:13.7 210.377
1 1 2009 1 Australian Grand Prix Albert Park Grand Prix Circuit FALSE Australia Nico Rosberg 01:27.7 217.668
2 2 2009 2 Malaysian Grand Prix Sepang International Circuit TRUE Malaysia Jenson Button 01:36.6 206.483
3 17 2009 3 Chinese Grand Prix Shanghai International Circuit TRUE China Rubens Barrichello 01:52.6 174.289
4 3 2009 4 Bahrain Grand Prix Bahrain International Circuit FALSE Bahrain Jarno Trulli 01:34.6 206.049
5 4 2009 5 Spanish Grand Prix Circuit de Barcelona-Catalunya FALSE Spain Rubens Barrichello 01:22.8 202.484
6 6 2009 6 Monaco Grand Prix Circuit de Monaco FALSE Monaco Felipe Massa 01:15.2 159.991
7 5 2009 7 Turkish Grand Prix Istanbul Park FALSE Turkey Jenson Button 01:27.6 219.422
8 9 2009 8 British Grand Prix Silverstone Circuit FALSE UK Sebastian Vettel 01:20.7 229.238
9 20 2009 9 German Grand Prix NÌ_rburgring FALSE Germany Fernando Alonso 01:33.4 198.498
10 11 2009 10 Hungarian Grand Prix Hungaroring FALSE Hungary Mark Webber 01:21.9 192.498
11 12 2009 11 European Grand Prix Valencia Street Circuit FALSE Spain Timo Glock 01:38.7 197.687
12 13 2009 12 Belgian Grand Prix Circuit de Spa-Francorchamps FALSE Belgium Sebastian Vettel 01:47.3 235.07
13 14 2009 13 Italian Grand Prix Autodromo Nazionale di Monza FALSE Italy Adrian Sutil 01:24.7 246.106
14 15 2009 14 Singapore Grand Prix Marina Bay Street Circuit FALSE Singapore Fernando Alonso 01:48.2 168.725
15 22 2009 15 Japanese Grand Prix Suzuka Circuit FALSE Japan Mark Webber 01:32.6 225.833
16 18 2009 16 Brazilian Grand Prix AutÌ_dromo JosÌ© Carlos Pace FALSE Brazil Mark Webber 01:13.7 210.386
17 24 2009 17 Abu Dhabi Grand Prix Yas Marina Circuit FALSE UAE Sebastian Vettel 01:40.3 199.387
337 3 2010 1 Bahrain Grand Prix Bahrain International Circuit FALSE Bahrain Fernando Alonso 01:58.3 191.706
338 1 2010 2 Australian Grand Prix Albert Park Grand Prix Circuit TRUE Australia Mark Webber 01:28.4 216.061
339 2 2010 3 Malaysian Grand Prix Sepang International Circuit FALSE Malaysia Mark Webber 01:37.1 205.605
340 17 2010 4 Chinese Grand Prix Shanghai International Circuit TRUE China Lewis Hamilton 01:42.1 192.273
341 4 2010 5 Spanish Grand Prix Circuit de Barcelona-Catalunya FALSE Spain Lewis Hamilton 01:24.4 198.655
342 6 2010 6 Monaco Grand Prix Circuit de Monaco FALSE Monaco Sebastian Vettel 01:15.2 159.91
343 5 2010 7 Turkish Grand Prix Istanbul Park FALSE Turkey Vitaly Petrov 01:29.2 215.519
344 7 2010 8 Canadian Grand Prix Circuit Gilles Villeneuve FALSE Canada Robert Kubica 01:17.0 203.965
345 12 2010 9 European Grand Prix Valencia Street Circuit FALSE Spain Jenson Button 01:38.8 197.521
346 9 2010 10 British Grand Prix Silverstone Circuit FALSE UK Fernando Alonso 01:30.9 233.373
347 10 2010 11 German Grand Prix Hockenheimring FALSE Germany Sebastian Vettel 01:15.8 217.166
348 11 2010 12 Hungarian Grand Prix Hungaroring FALSE Hungary Sebastian Vettel 01:22.4 191.491
349 13 2010 13 Belgian Grand Prix Circuit de Spa-Francorchamps TRUE Belgium Lewis Hamilton 01:49.1 231.178
350 14 2010 14 Italian Grand Prix Autodromo Nazionale di Monza FALSE Italy Fernando Alonso 01:24.1 247.861
351 15 2010 15 Singapore Grand Prix Marina Bay Street Circuit FALSE Singapore Fernando Alonso 01:48.0 169.137
352 22 2010 16 Japanese Grand Prix Suzuka Circuit TRUE Japan Mark Webber 01:33.5 223.647
353 35 2010 17 Korean Grand Prix Korean International Circuit TRUE Korea Fernando Alonso 01:50.3 183.335
354 18 2010 18 Brazilian Grand Prix AutÌ_dromo JosÌ© Carlos Pace FALSE Brazil Lewis Hamilton 01:13.9 210.049
355 24 2010 19 Abu Dhabi Grand Prix Yas Marina Circuit FALSE UAE Lewis Hamilton 01:41.3 197.428
841 1 2011 1 Australian Grand Prix Albert Park Grand Prix Circuit FALSE Australia Felipe Massa 01:28.9 214.631
842 2 2011 2 Malaysian Grand Prix Sepang International Circuit FALSE Malaysia Mark Webber 01:40.6 198.415
844 5 2011 4 Turkish Grand Prix Istanbul Park FALSE Turkey Mark Webber 01:29.7 214.226
845 4 2011 5 Spanish Grand Prix Circuit de Barcelona-Catalunya FALSE Spain Lewis Hamilton 01:26.7 193.227
846 6 2011 6 Monaco Grand Prix Circuit de Monaco FALSE Monaco Mark Webber 01:16.2 157.724
847 7 2011 7 Canadian Grand Prix Circuit Gilles Villeneuve TRUE Canada Jenson Button 01:17.0 204.007
848 12 2011 8 European Grand Prix Valencia Street Circuit FALSE Spain Sebastian Vettel 01:41.9 191.536
849 9 2011 9 British Grand Prix Silverstone Circuit FALSE UK Fernando Alonso 01:34.9 223.454
850 20 2011 10 German Grand Prix NÌ_rburgring TRUE Germany Lewis Hamilton 01:34.3 196.526
851 11 2011 11 Hungarian Grand Prix Hungaroring TRUE Hungary Felipe Massa 01:23.4 189.073
852 13 2011 12 Belgian Grand Prix Circuit de Spa-Francorchamps FALSE Belgium Mark Webber 01:49.9 229.465
853 14 2011 13 Italian Grand Prix Autodromo Nazionale di Monza FALSE Italy Lewis Hamilton 01:26.2 241.971
854 15 2011 14 Singapore Grand Prix Marina Bay Street Circuit FALSE Singapore Jenson Button 01:48.5 168.392
855 22 2011 15 Japanese Grand Prix Suzuka Circuit FALSE Japan Jenson Button 01:36.6 216.481
856 35 2011 16 Korean Grand Prix Korean International Circuit TRUE Korea Sebastian Vettel 01:39.6 202.941
857 68 2011 17 Indian Grand Prix Buddh International Circuit FALSE India Sebastian Vettel 01:27.2 211.463
858 24 2011 18 Abu Dhabi Grand Prix Yas Marina Circuit FALSE UAE Mark Webber 01:42.6 194.854
859 18 2011 19 Brazilian Grand Prix AutÌ_dromo JosÌ© Carlos Pace FALSE Brazil Mark Webber 01:15.3 205.942
860 1 2012 1 Australian Grand Prix Albert Park Grand Prix Circuit FALSE Australia Jenson Button 01:29.2 214.053
861 2 2012 2 Malaysian Grand Prix Sepang International Circuit TRUE Malaysia Kimi RÌ_ikk̦nen 01:40.7 198.117
862 17 2012 3 Chinese Grand Prix Shanghai International Circuit FALSE China Kamui Kobayashi 01:40.0 196.314
863 3 2012 4 Bahrain Grand Prix Bahrain International Circuit FALSE Bahrain Sebastian Vettel 01:36.4 202.151
864 4 2012 5 Spanish Grand Prix Circuit de Barcelona-Catalunya FALSE Spain Romain Grosjean 01:26.3 194.295
865 6 2012 6 Monaco Grand Prix Circuit de Monaco FALSE Monaco Sergio PÌ©rez 01:17.3 155.557
866 7 2012 7 Canadian Grand Prix Circuit Gilles Villeneuve FALSE Canada Sebastian Vettel 01:15.8 207.249
867 12 2012 8 European Grand Prix Valencia Street Circuit FALSE Spain Nico Rosberg 01:42.2 190.953
868 9 2012 9 British Grand Prix Silverstone Circuit FALSE UK Kimi RÌ_ikk̦nen 01:34.7 224.037
869 10 2012 10 German Grand Prix Hockenheimring FALSE Germany Michael Schumacher 01:18.7 209.163
870 11 2012 11 Hungarian Grand Prix Hungaroring FALSE Hungary Sebastian Vettel 01:24.1 187.453
871 13 2012 12 Belgian Grand Prix Circuit de Spa-Francorchamps FALSE Belgium Bruno Senna 01:52.8 223.488
872 14 2012 13 Italian Grand Prix Autodromo Nazionale di Monza FALSE Italy Nico Rosberg 01:27.2 239.053
873 15 2012 14 Singapore Grand Prix Marina Bay Street Circuit FALSE Singapore Nico HÌ_lkenberg 01:51.0 164.48
874 22 2012 15 Japanese Grand Prix Suzuka Circuit FALSE Japan Sebastian Vettel 01:35.8 218.276
875 35 2012 16 Korean Grand Prix Korean International Circuit FALSE Korea Mark Webber 01:42.0 198.104
876 68 2012 17 Indian Grand Prix Buddh International Circuit FALSE India Jenson Button 01:28.2 209.176
877 24 2012 18 Abu Dhabi Grand Prix Yas Marina Circuit FALSE UAE Sebastian Vettel 01:44.0 192.32
878 69 2012 19 United States Grand Prix Circuit of the Americas FALSE USA Sebastian Vettel 01:39.3 199.772
879 18 2012 20 Brazilian Grand Prix AutÌ_dromo JosÌ© Carlos Pace TRUE Brazil Lewis Hamilton 01:18.1 198.701
880 1 2013 1 Australian Grand Prix Albert Park Grand Prix Circuit FALSE Australia Kimi RÌ_ikk̦nen 01:29.3 213.845
881 2 2013 2 Malaysian Grand Prix Sepang International Circuit TRUE Malaysia Sergio PÌ©rez 01:39.2 201.159
882 17 2013 3 Chinese Grand Prix Shanghai International Circuit FALSE China Sebastian Vettel 01:36.8 202.706
883 3 2013 4 Bahrain Grand Prix Bahrain International Circuit FALSE Bahrain Sebastian Vettel 01:37.0 200.938
884 4 2013 5 Spanish Grand Prix Circuit de Barcelona-Catalunya FALSE Spain Esteban Guti̩rrez 01:26.2 194.37
885 6 2013 6 Monaco Grand Prix Circuit de Monaco FALSE Monaco Sebastian Vettel 01:16.6 157.018
886 7 2013 7 Canadian Grand Prix Circuit Gilles Villeneuve FALSE Canada Mark Webber 01:16.2 206.08
887 9 2013 8 British Grand Prix Silverstone Circuit FALSE UK Mark Webber 01:33.4 227.059
888 20 2013 9 German Grand Prix NÌ_rburgring FALSE Germany Fernando Alonso 01:33.5 198.279
890 11 2013 10 Hungarian Grand Prix Hungaroring FALSE Hungary Mark Webber 01:24.1 187.603
891 13 2013 11 Belgian Grand Prix Circuit de Spa-Francorchamps FALSE Belgium Sebastian Vettel 01:50.8 227.657
892 14 2013 12 Italian Grand Prix Autodromo Nazionale di Monza FALSE Italy Lewis Hamilton 01:25.8 242.924
893 15 2013 13 Singapore Grand Prix Marina Bay Street Circuit FALSE Singapore Sebastian Vettel 01:48.6 167.94
894 35 2013 14 Korean Grand Prix Korean International Circuit FALSE Korea Sebastian Vettel 01:41.4 199.388
895 22 2013 15 Japanese Grand Prix Suzuka Circuit FALSE Japan Mark Webber 01:34.6 221.015
896 68 2013 16 Indian Grand Prix Buddh International Circuit FALSE India Kimi RÌ_ikk̦nen 01:27.7 210.426
897 24 2013 17 Abu Dhabi Grand Prix Yas Marina Circuit FALSE UAE Fernando Alonso 01:43.4 193.305
898 69 2013 18 United States Grand Prix Circuit of the Americas FALSE USA Sebastian Vettel 01:39.9 198.754
899 18 2013 19 Brazilian Grand Prix AutÌ_dromo JosÌ© Carlos Pace FALSE Brazil Mark Webber 01:15.4 205.636
900 1 2014 1 Australian Grand Prix Albert Park Grand Prix Circuit FALSE Australia Nico Rosberg 01:32.5 206.436
901 2 2014 2 Malaysian Grand Prix Sepang International Circuit FALSE Malaysia Lewis Hamilton 01:43.1 193.611
902 3 2014 3 Bahrain Grand Prix Bahrain International Circuit FALSE Bahrain Nico Rosberg 01:37.0 200.816
903 17 2014 4 Chinese Grand Prix Shanghai International Circuit FALSE China Nico Rosberg 01:40.4 195.45
904 4 2014 5 Spanish Grand Prix Circuit de Barcelona-Catalunya FALSE Spain Sebastian Vettel 01:28.9 188.465
905 6 2014 6 Monaco Grand Prix Circuit de Monaco FALSE Monaco Kimi RÌ_ikk̦nen 01:18.5 153.212
906 7 2014 7 Canadian Grand Prix Circuit Gilles Villeneuve FALSE Canada Felipe Massa 01:18.5 199.984
907 70 2014 8 Austrian Grand Prix Red Bull Ring FALSE Austria Sergio PÌ©rez 01:12.1 215.874
908 9 2014 9 British Grand Prix Silverstone Circuit FALSE UK Lewis Hamilton 01:37.2 218.239
909 10 2014 10 German Grand Prix Hockenheimring FALSE Germany Lewis Hamilton 01:19.9 206.066
910 11 2014 11 Hungarian Grand Prix Hungaroring FALSE Hungary Nico Rosberg 01:25.7 183.981
911 13 2014 12 Belgian Grand Prix Circuit de Spa-Francorchamps FALSE Belgium Nico Rosberg 01:50.5 228.161
912 14 2014 13 Italian Grand Prix Autodromo Nazionale di Monza FALSE Italy Lewis Hamilton 01:28.0 236.975
913 15 2014 14 Singapore Grand Prix Marina Bay Street Circuit FALSE Singapore Lewis Hamilton 01:50.4 165.137
914 22 2014 15 Japanese Grand Prix Suzuka Circuit TRUE Japan Lewis Hamilton 01:51.6 187.322
915 71 2014 16 Russian Grand Prix Sochi Autodrom FALSE Russia Valtteri Bottas 01:40.9 208.658
916 69 2014 17 United States Grand Prix Circuit of the Americas FALSE USA Sebastian Vettel 01:41.4 195.768
917 18 2014 18 Brazilian Grand Prix AutÌ_dromo JosÌ© Carlos Pace FALSE Brazil Lewis Hamilton 01:13.6 210.895
918 24 2014 19 Abu Dhabi Grand Prix Yas Marina Circuit FALSE UAE Daniel Ricciardo 01:44.5 191.341
926 1 2015 1 Australian Grand Prix Albert Park Grand Prix Circuit FALSE Australia Lewis Hamilton 01:30.9 209.915
927 2 2015 2 Malaysian Grand Prix Sepang International Circuit FALSE Malaysia Nico Rosberg 01:42.1 195.516
928 17 2015 3 Chinese Grand Prix Shanghai International Circuit FALSE China Lewis Hamilton 01:42.2 191.996
929 3 2015 4 Bahrain Grand Prix Bahrain International Circuit FALSE Bahrain Kimi RÌ_ikk̦nen 01:36.3 202.294
930 4 2015 5 Spanish Grand Prix Circuit de Barcelona-Catalunya FALSE Spain Lewis Hamilton 01:28.3 189.849
931 6 2015 6 Monaco Grand Prix Circuit de Monaco FALSE Monaco Daniel Ricciardo 01:18.1 153.891
932 7 2015 7 Canadian Grand Prix Circuit Gilles Villeneuve FALSE Canada Kimi RÌ_ikk̦nen 01:17.0 203.925
933 70 2015 8 Austrian Grand Prix Red Bull Ring FALSE Austria Nico Rosberg 01:11.2 218.622
934 9 2015 9 British Grand Prix Silverstone Circuit TRUE UK Lewis Hamilton 01:37.1 218.425
936 11 2015 10 Hungarian Grand Prix Hungaroring FALSE Hungary Daniel Ricciardo 01:24.8 185.939
937 13 2015 11 Belgian Grand Prix Circuit de Spa-Francorchamps FALSE Belgium Nico Rosberg 01:52.4 224.295
938 14 2015 12 Italian Grand Prix Autodromo Nazionale di Monza FALSE Italy Lewis Hamilton 01:26.7 240.617
939 15 2015 13 Singapore Grand Prix Marina Bay Street Circuit FALSE Singapore Daniel Ricciardo 01:50.0 165.701
940 22 2015 14 Japanese Grand Prix Suzuka Circuit FALSE Japan Lewis Hamilton 01:36.1 217.434
941 71 2015 15 Russian Grand Prix Sochi Autodrom FALSE Russia Sebastian Vettel 01:40.1 210.378
942 69 2015 16 United States Grand Prix Circuit of the Americas FALSE USA Nico Rosberg 01:40.7 197.154
943 32 2015 17 Mexican Grand Prix AutÌ_dromo Hermanos RodrÌ_guez FALSE Mexico Nico Rosberg 01:20.5 192.426
944 18 2015 18 Brazilian Grand Prix AutÌ_dromo JosÌ© Carlos Pace FALSE Brazil Lewis Hamilton 01:14.8 207.296
945 24 2015 19 Abu Dhabi Grand Prix Yas Marina Circuit FALSE UAE Lewis Hamilton 01:44.5 191.302
948 1 2016 1 Australian Grand Prix Albert Park Grand Prix Circuit FALSE Australia Daniel Ricciardo 01:29.0 214.51
949 3 2016 2 Bahrain Grand Prix Bahrain International Circuit FALSE Bahrain Nico Rosberg 01:34.5 206.21
950 17 2016 3 Chinese Grand Prix Shanghai International Circuit FALSE China Nico HÌ_lkenberg 01:39.8 196.581
951 71 2016 4 Russian Grand Prix Sochi Autodrom FALSE Russia Nico Rosberg 01:39.1 212.452
952 4 2016 5 Spanish Grand Prix Circuit de Barcelona-Catalunya FALSE Spain Daniil Kvyat 01:26.9 192.735
953 6 2016 6 Monaco Grand Prix Circuit de Monaco TRUE Monaco Lewis Hamilton 01:17.9 154.135
954 7 2016 7 Canadian Grand Prix Circuit Gilles Villeneuve FALSE Canada Nico Rosberg 01:15.6 207.669
955 73 2016 8 European Grand Prix Baku City Circuit FALSE Azerbaijan Nico Rosberg 01:46.5 202.946
956 70 2016 9 Austrian Grand Prix Red Bull Ring FALSE Austria Lewis Hamilton 01:08.4 227.647
957 9 2016 10 British Grand Prix Silverstone Circuit FALSE UK Nico Rosberg 01:35.5 221.957
958 11 2016 11 Hungarian Grand Prix Hungaroring FALSE Hungary Kimi RÌ_ikk̦nen 01:23.1 189.822
959 10 2016 12 German Grand Prix Hockenheimring FALSE Germany Daniel Ricciardo 01:18.4 209.918
960 13 2016 13 Belgian Grand Prix Circuit de Spa-Francorchamps FALSE Belgium Lewis Hamilton 01:51.6 225.969
961 14 2016 14 Italian Grand Prix Autodromo Nazionale di Monza FALSE Italy Fernando Alonso 01:25.3 244.373
962 15 2016 15 Singapore Grand Prix Marina Bay Street Circuit FALSE Singapore Daniel Ricciardo 01:47.2 170.113
963 2 2016 16 Malaysian Grand Prix Sepang International Circuit FALSE Malaysia Nico Rosberg 01:36.4 206.948
964 22 2016 17 Japanese Grand Prix Suzuka Circuit FALSE Japan Sebastian Vettel 01:35.1 219.781
965 69 2016 18 United States Grand Prix Circuit of the Americas FALSE USA Sebastian Vettel 01:39.9 198.712
966 32 2016 19 Mexican Grand Prix AutÌ_dromo Hermanos RodrÌ_guez FALSE Mexico Daniel Ricciardo 01:21.1 190.972
967 18 2016 20 Brazilian Grand Prix AutÌ_dromo JosÌ© Carlos Pace TRUE Brazil Max Verstappen 01:25.3 181.846
968 24 2016 21 Abu Dhabi Grand Prix Yas Marina Circuit FALSE UAE Sebastian Vettel 01:43.7 192.756
969 1 2017 1 Australian Grand Prix Albert Park Grand Prix Circuit FALSE Australia Kimi RÌ_ikk̦nen 01:26.5 220.605
970 17 2017 2 Chinese Grand Prix Shanghai International Circuit FALSE China Lewis Hamilton 01:35.4 205.745
971 3 2017 3 Bahrain Grand Prix Bahrain International Circuit FALSE Bahrain Lewis Hamilton 01:32.8 209.952
972 71 2017 4 Russian Grand Prix Sochi Autodrom FALSE Russia Kimi RÌ_ikk̦nen 01:36.8 217.388
973 4 2017 5 Spanish Grand Prix Circuit de Barcelona-Catalunya FALSE Spain Lewis Hamilton 01:23.6 200.471
974 6 2017 6 Monaco Grand Prix Circuit de Monaco FALSE Monaco Sergio PÌ©rez 01:14.8 160.561
975 7 2017 7 Canadian Grand Prix Circuit Gilles Villeneuve FALSE Canada Lewis Hamilton 01:14.6 210.588
976 73 2017 8 Azerbaijan Grand Prix Baku City Circuit FALSE Azerbaijan Sebastian Vettel 01:43.4 208.919
977 70 2017 9 Austrian Grand Prix Red Bull Ring FALSE Austria Lewis Hamilton 01:07.4 230.597
978 9 2017 10 British Grand Prix Silverstone Circuit FALSE UK Lewis Hamilton 01:30.6 234.025
979 11 2017 11 Hungarian Grand Prix Hungaroring FALSE Hungary Fernando Alonso 01:20.2 196.697
980 13 2017 12 Belgian Grand Prix Circuit de Spa-Francorchamps FALSE Belgium Sebastian Vettel 01:46.6 236.583
981 14 2017 13 Italian Grand Prix Autodromo Nazionale di Monza FALSE Italy Daniel Ricciardo 01:23.4 250.174
982 15 2017 14 Singapore Grand Prix Marina Bay Street Circuit FALSE Singapore Lewis Hamilton 01:45.0 173.643
983 2 2017 15 Malaysian Grand Prix Sepang International Circuit FALSE Malaysia Sebastian Vettel 01:34.1 212.104
984 22 2017 16 Japanese Grand Prix Suzuka Circuit FALSE Japan Valtteri Bottas 01:33.1 224.439
985 69 2017 17 United States Grand Prix Circuit of the Americas FALSE USA Kimi RÌ_ikk̦nen 01:37.8 203.003
986 32 2017 18 Mexican Grand Prix AutÌ_dromo Hermanos RodrÌ_guez FALSE Mexico Sebastian Vettel 01:18.8 196.666
987 18 2017 19 Brazilian Grand Prix AutÌ_dromo JosÌ© Carlos Pace FALSE Brazil Max Verstappen 01:11.0 218.349
988 24 2017 20 Abu Dhabi Grand Prix Yas Marina Circuit FALSE UAE Valtteri Bottas 01:40.7 198.652
<!DOCTYPE html>
<meta charset="utf-8">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400" rel="stylesheet">
<style>
svg {
font-family: "Montserrat", sans-serif;
font-size: 10px;
}
.polygons {
fill: none;
pointer-events: all;
}
path.domain {
display: none;
}
.y--axis line {
stroke: #ddd;
shape-rendering: crispEdges;
}
.y--axis text {
fill: none;
font-size: 8px;
padding-right: 5px;
}
svg:nth-child(4n-1) .y--axis text {
fill: #777;
}
</style>
<body>
</body>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script>
const margin = {top: 30, right: 5, bottom: 15, left: 25},
width = 200 - margin.left - margin.right,
height = 120 - margin.bottom - margin.top;
const parseTime = d3.timeParse("%M:%S.%L");
const x = d3.scaleLinear().range([0, width]),
y = d3.scaleLinear().range([height, 0]),
color = d3.scaleSequential(d3.interpolateMagma);
const voronoi = d3.voronoi()
.x(d => x(d.year))
.y(d => y(d.speed))
.extent([[-5, -5], [width + 5, height + 5]]);
d3.csv("fastest_lap.csv", type, (error, data) => {
if (error) return console.error(error);
const circuits = d3.nest()
.key(d => d.circuit)
.sortValues((a, b) => a.speed < b.speed ? 1 : -1)
.entries(data);
const svg = d3.select("body").selectAll("svg")
.data(circuits)
.enter().append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("id", d => "circuit-" + d.values[0].circuitId)
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
x.domain(d3.extent(data, d => d.year));
y.domain(d3.extent(data, d => d.speed));
color.domain(y.domain());
svg.append("g")
.attr("class", "y--axis")
.call(d3.axisLeft(y).tickValues([160, 200, 240]).tickSize(-width));
svg.append("text")
.attr("y", -margin.top / 2)
.attr("dy", "0.35em")
.text(d => d.key);
svg.selectAll(".lap")
.data(d => d.values)
.enter().append("circle")
.attr("class", "lap")
.style("r", (d,i) => i == 0 ? 3 : 2)
.attr("cx", d => x(d.year))
.attr("cy", d => y(d.speed))
.style("fill", d => d.rain ? color(d.speed) : "white")
.style("stroke", d => color(d.speed));
svg.append("text")
.attr("class", "info")
.attr("dy", "0.35em")
.text("");
svg.selectAll(".polygons")
.data(d => voronoi.polygons(d.values))
.enter().append("path")
.attr("class", "polygons")
.attr("d", d => d ? "M" + d.join("L") + "Z" : null)
.on("mouseover", mouseover)
.on("mouseout", mouseout);
});
function mouseover(d) {
d3.select("#circuit-" + d.data.circuitId)
.select(".info")
.text(d.data.year + " " + d.data.surname + " - " + d.data.fastestLapTime);
}
function mouseout(d) {
d3.selectAll(".info").text("");
}
function type(d) {
d.speed = +d.fastestLapSpeed;
d.rain = d.rain == "TRUE";
return d;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment