Skip to content

Instantly share code, notes, and snippets.

@bhaskarvk
Last active February 17, 2017 20:29
Show Gist options
  • Save bhaskarvk/229cca8dfd067cfbcb3074c85b950abb to your computer and use it in GitHub Desktop.
Save bhaskarvk/229cca8dfd067cfbcb3074c85b950abb to your computer and use it in GitHub Desktop.
Need to move Y axis label above Y axis text.
OrgSize n
Large 32
Very Large 36
Very Small 43
Small 60
Medium 67
suppressMessages(library(ggplot2))
suppressMessages(library(ggalt))
# devtools::install_github('hrbrmstr/hrbrthemes')
library(hrbrthemes)
scale_x_orgsize <- scale_x_discrete(labels=c(
'Very Small\n(<250 employees)',
'Small\n(251-2,000 employees)',
'Medium\n(2,001-10,000 employees)',
'Large\n(10,001-50,000 employees)',
'Very Large\n(>50,000 employees)'))
orgsize <- readr::read_csv('https://gist.github.com/bhaskarvk/229cca8dfd067cfbcb3074c85b950abb/raw/a6dc75e2c9680ee1148edba71b22f39d23cb2f9e/orgs_by_size.csv')
ggplot(
orgsize, aes(x = OrgSize, y = n)) +
geom_lollipop(point.colour = '#000000', point.size = 1) +
coord_flip() +
labs(list(
x = 'Organization Size', y = 'Number of Orgs.', title = NULL)) +
scale_x_orgsize +
theme_ipsum_rc(grid='X', axis_title_face = 'bold') +
theme(axis.title.y = element_text(angle = 0, vjust = 1))
@bhive01
Copy link

bhive01 commented Feb 17, 2017

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