Skip to content

Instantly share code, notes, and snippets.

@mrecos
Last active July 15, 2021 13:07
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 mrecos/6abb8e2668a49886ea3f4bcba30c2ae5 to your computer and use it in GitHub Desktop.
Save mrecos/6abb8e2668a49886ea3f4bcba30c2ae5 to your computer and use it in GitHub Desktop.
dat <- data.frame(Response = c("Yes","No"), Value = c(0.32,0.68))
ggplot(dat, aes(x = Response, y = Value)) +
geom_bar(stat = "identity", width = 0.5) +
xlab("") +
ylab("") +
theme_bw() +
scale_y_continuous(limits = c(0,1)) +
geom_text(aes(label = paste0(Value*100,"%")), vjust = -1,
hjust = 0.5, face = "bold", size = 6) +
labs(title = "Will Ethics be a Primary Focus in 2030?",
subtitle = "602 responses non-randomly selected",
caption = "Source: https://tinyurl.com/yt9xz4z7\nCode for plot:https://tinyurl.com/rxep5e2v") +
theme(axis.text.x = element_text(angle = 0, hjust = 0.5,
face = "bold", size = 20),
axis.text.y = element_blank(),
axis.title.y = element_blank(),
axis.ticks.y = element_blank())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment