Star Wars Character Comparison

The below bubble chart shows us a comparison between the star wars character. We have used the inbuilt R dataset starwars of the package dplyr. The bubble chart has the following interactivity

p <- starwars %>% 
  arrange(desc(mass)) %>% 
  mutate(name = factor(name, name), n_movie = lengths(films)) %>% 
  mutate(text = paste("Name: ", name, "\nHeight: ", height, "\nMass: ", mass, "\nAge: ", birth_year, "\nHomeworld: ", homeworld, "\nGender: ",gender, "\nSpecies: ", species, "\nNumber of movies: ", n_movie, sep="")) %>%
  ggplot(aes(x = height, y = birth_year, size = mass, color = homeworld, text = text)) +
   geom_point(alpha=0.7) +
    scale_size(range = c(1.4, 19), name="Size") +
    scale_color_viridis(discrete=TRUE, guide=FALSE) +
    theme_ipsum() +
    theme(legend.position="none") + 
  ggtitle("Star Wars Characters Comparison Chart") + 
  xlab("Height") +
  ylab("Age")

pp <- ggplotly(p, tooltip="text")
pp

In the above bubble chart the size of the bubble gives us the size of the characters and the color of the bubble denotes the different home world. The tooltip gives us information regarding their gender, name, species and the number of Star War movies they appeared in.

From the above chart we can make the following observations:

  1. The largest and oldest character in Star Wars Jabba the Hutt who appeared in 3 movies
  2. The smallest and youngest character in Star Wars is Wicket the Ewok who appeared in 1 movie