Chapter 22 Surfaces

The number of matches on different surfaces are shown in a bar plot.

matches %>%
  filter(!is.na(surface)) %>%
  filter(!str_detect(surface,"-")) %>%
  group_by(surface) %>%
  summarise(Count = n()) %>%
  arrange(desc(Count)) %>%
  ungroup() %>%
  mutate(surface = reorder(surface,Count)) %>%
  
 
  ggplot(aes(x = surface,y = Count)) +
  geom_bar(stat='identity',colour="white",fill=fillColor2) +
  geom_text(aes(x = surface, y = 1, label = paste0("(",Count,")",sep="")),
            hjust=0, vjust=.5, size = 4, colour = 'black',
            fontface = 'bold') +
  labs(x = 'Surface', 
       y = 'Count', 
       title = 'Surface and Count') +
  coord_flip() + 
  theme_bw()

During the period 2000 - 2017 ( part of the data of 2017 is present) , the following observations are made

  • Williams sisters occupy the 1st and 2nd spots in the winners list

  • Considering all surfaces , Russians , Americans and French have won the most matches

  • On the Hard surface, Russians, Americans and French occupy the top Three positions

  • On the Clay surface, Russians, Spanish and Americans occupy the top Three positions

  • On the Grass surface, Americans,Russians and Australians and occupy the top Three positions

  • On the Carpet surface, Russians, French and Americans occupy the top Three positions

22.1 All Surfaces

Top 10 winners on All surfaces is shown below

matches %>%
  group_by(winner_name) %>%
  summarise(Count = n()) %>%
  arrange(desc(Count)) %>%
  ungroup() %>%
  mutate(winner_name = reorder(winner_name,Count)) %>%
  head(10) %>%
 
  ggplot(aes(x = winner_name,y = Count)) +
  geom_bar(stat='identity',colour="white",fill=fillColor) +
  geom_text(aes(x = winner_name, y = 1, label = paste0("(",Count,")",sep="")),
            hjust=0, vjust=.5, size = 4, colour = 'black',
            fontface = 'bold') +
  labs(x = 'Winner', 
       y = 'Count', 
       title = 'Winner and Count') +
  coord_flip() + 
  theme_bw()

surfaceTitle = 'Country Winning on All Surfaces' 

 matches %>%
  group_by(winner_ioc) %>%
  summarise(Count = n()) %>%
  arrange(desc(Count)) %>%
  ungroup() %>%
  mutate(winner_ioc = reorder(winner_ioc,Count)) %>%
  head(10) %>%
 
  ggplot(aes(x = winner_ioc,y = Count)) +
  geom_bar(stat='identity',colour="white",fill=fillColor) +
  geom_text(aes(x = winner_ioc, y = 1, label = paste0("(",Count,")",sep="")),
            hjust=0, vjust=.5, size = 4, colour = 'black',
            fontface = 'bold') +
  labs(x = surfaceTitle, 
       y = 'Count', 
       title = surfaceTitle) +
  coord_flip() + 
  theme_bw()

22.2 Hard Surface

Top 10 winners on the Hard surface is shown below

surfaceWinners = function(surfaceName)
{
  matches %>%
  filter(surface == surfaceName) %>%
  group_by(winner_name) %>%
  summarise(Count = n()) %>%
  arrange(desc(Count)) %>%
  ungroup() %>%
  mutate(winner_name = reorder(winner_name,Count)) %>%
  head(10) %>%
 
  ggplot(aes(x = winner_name,y = Count)) +
  geom_bar(stat='identity',colour="white",fill=fillColor2) +
  geom_text(aes(x = winner_name, y = 1, label = paste0("(",Count,")",sep="")),
            hjust=0, vjust=.5, size = 4, colour = 'black',
            fontface = 'bold') +
  labs(x = 'Winner', 
       y = 'Count', 
       title = 'Winner and Count') +
  coord_flip() + 
  theme_bw()
  
}

countriesSurface = function(surfaceName,surfaceTitle)
{
  matches %>%
  filter(surface == surfaceName) %>%
  group_by(winner_ioc) %>%
  summarise(Count = n()) %>%
  arrange(desc(Count)) %>%
  ungroup() %>%
  mutate(winner_ioc = reorder(winner_ioc,Count)) %>%
  head(10) %>%
 
  ggplot(aes(x = winner_ioc,y = Count)) +
  geom_bar(stat='identity',colour="white",fill=fillColor) +
  geom_text(aes(x = winner_ioc, y = 1, label = paste0("(",Count,")",sep="")),
            hjust=0, vjust=.5, size = 4, colour = 'black',
            fontface = 'bold') +
  labs(x = surfaceTitle, 
       y = 'Count', 
       title = surfaceTitle) +
  coord_flip() + 
  theme_bw()
}

surfaceWinners('Hard')

countriesSurface('Hard','Country Winning on Hard Surface')

22.3 Clay Surface

Top 10 winners on the Clay surface is shown below

surfaceWinners('Clay')

countriesSurface('Clay','Country Winning on Clay Surface')

22.4 Grass Surface

Top 10 winners on the Grass surface is shown below

surfaceWinners('Grass')

countriesSurface('Grass','Country Winning on Grass Surface')

22.5 Carpet Surface

Top 10 winners on the Carpet surface is shown below

surfaceWinners('Carpet')

countriesSurface('Carpet','Country Winning on Carpet Surface')