Skip to content

Instantly share code, notes, and snippets.

@cavedave
Last active August 17, 2022 15:44
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 cavedave/cd35eaaff3a23183d7a017da83ca1280 to your computer and use it in GitHub Desktop.
Save cavedave/cd35eaaff3a23183d7a017da83ca1280 to your computer and use it in GitHub Desktop.
objects <-c('Truman','Eisenhower','Kennedy','Johnson','Nixon','Ford','Carter','Reagan','Bush','Clinton','G. W. Bush','Obama','Trump','Biden')
#'FDR', 0.796,
performance <- c(0.319,0.165,0.206,0.172,0.170,0.188,0.219,0.130,0.113,0.105,0.099,0.094,0.15,0.165)
color<-c('#0015BC', '#E9141D', '#0015BC', '#0015BC', '#E9141D', '#E9141D', '#0015BC', '#E9141D', '#E9141D', '#0015BC', '#E9141D', '#0015BC','#E9141D','#0015BC')
df<- data.frame(objects, performance, color)
#lock in order
df$objects <- factor(df$objects, levels = df$objects)
#
q<-ggplot(data=df, aes(x=objects, y=performance,colour=color,fill=color)) +
geom_bar(stat = "identity", position = "dodge",fill=color) +
scale_color_manual(values = levels(df$color),
labels = c("Democrat","Republican"))
#Now Labels etc
q<-q+labs(title="Presidential Executive Orders per Day",
caption="Source: wikipedia",
y="Orders per day",x="President")+
#theme_minimal()+
theme_classic()
#make names sideways, remove legend, move title
q<- q + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),legend.position="none",plot.title = element_text(hjust = 0.5))
ggsave("executive.png",width = 10, height = 8, dpi = 300)
q
@cavedave
Copy link
Author

executive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment