Skip to content

Instantly share code, notes, and snippets.

@jaytimm
Created November 24, 2018 15:54
Show Gist options
  • Save jaytimm/91b16aef4fb026fb0cebd3a67d826fe9 to your computer and use it in GitHub Desktop.
Save jaytimm/91b16aef4fb026fb0cebd3a67d826fe9 to your computer and use it in GitHub Desktop.
library(tidyverse)
library(Rvoteview)
library(ggrepel)
library(ggthemes)
house115 <- Rvoteview:: member_search(chamber= 'House', congress = 115) %>%
mutate(name = gsub(', .*$', '', bioname))
reps <- c("O'ROURKE", "WATERS", "PELOSI", "LAMB", "SCHIFF",
"CURBELO", "MCSALLY", "MCCARTHY", "JORDAN")
house115 %>%
ggplot(aes(x=nominate.dim1,
y=nominate.dim2,
label = name)) +
annotate("path",
x=cos(seq(0,2*pi,length.out=300)),
y=sin(seq(0,2*pi,length.out=300)),
color='gray',
size = .25) +
geom_point(aes(color = as.factor(party_code)),
size= 2,
shape= 17) +
ggrepel::geom_text_repel(
data = subset(house115, toupper(name) %in% toupper(reps)),
nudge_y = -0.025,
segment.color = "grey50",
direction = "y",
hjust = 0,
size = 3.5 ) +
ggthemes::scale_color_stata() +
#ggthemes::theme_fivethirtyeight() +
theme(legend.position = 'none',
plot.title = element_text(size=12),
axis.title = element_text())+
xlab('DW-Nominate D1') + ylab('DW-Nominate D2') +
labs(title="DW-Nominate ideology scores for the 115th US House",
caption = "SOURCE: VoteView.com")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment