Skip to content

Instantly share code, notes, and snippets.

@kissmygritts
Created August 6, 2015 02:43
Show Gist options
  • Save kissmygritts/36a2c71fc94311cb3651 to your computer and use it in GitHub Desktop.
Save kissmygritts/36a2c71fc94311cb3651 to your computer and use it in GitHub Desktop.
plotting actor/actress age data
library(ggplot2)
library(ggmap)
library(wesanderson)
dat <- read.csv("Movies - AgeGap (3).csv")
g <- ggplot(data = dat, aes(x = Actress, y = Actor)) +
geom_point(aes(color = factor(Genre)), size = 2.1) +
geom_smooth(method = "lm", se = F, aes(group = factor(Genre), color = factor(Genre)), size = 1) +
#geom_abline(intercept = 0, slope = 1, color = "#227186", size = 1) + ## age equality line
scale_y_continuous(breaks = seq(10, 75, 5)) +
scale_x_continuous(breaks = seq(10, 80, 5)) +
coord_fixed(ratio = 1) +
scale_color_manual(values = wes_palette("Moonrise3")) +
labs(list(title = "Asymmetrical Aging in Hollywood", x = "Actress Age", y = "Actor Age")) +
theme_bw() +
theme(axis.line = element_line(color = "#3d311b"),
panel.border = element_blank(),
panel.grid.major = element_line(color = "#e3d6bf"),
panel.grid.minor = element_line(color = "#f2ede2"),
legend.position = "top")
g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment