xdf <- read.csv("C:/Users/s-das/Syncplicity Folders/MyProjects_IMP/MY_Papers_V2/TRB 2020/a1.csv")
library(ggplot2)
head(xdf)
library(hrbrthemes)
## NOTE: Either Arial Narrow or Roboto Condensed fonts are *required* to use these themes.
##       Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
##       if Arial Narrow is not on your system, please see http://bit.ly/arialnarrow
library(tidyverse)
## -- Attaching packages --------------------------------------------------------------------------------- tidyverse 1.2.1 --
## v tibble  2.0.1       v purrr   0.2.5  
## v tidyr   0.8.2       v dplyr   0.8.0.1
## v readr   1.1.1       v stringr 1.3.1  
## v tibble  2.0.1       v forcats 0.3.0
## -- Conflicts ------------------------------------------------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
xdf <- mutate(xdf, dir = factor(sign(act - say)))
xdf <- mutate(xdf, actually_read = -act, say_want_covered = -say)
head(xdf)
ggplot() +
  geom_segment(
    data = xdf,
    aes(
      "Actually read", act,
      xend = "Say they\nwant covered", yend = say,
      color = dir, size = dir
    ), show.legend = FALSE
  ) +
  geom_vline(aes(xintercept = c(1, 2)), color = "#b2b2b2") +
  geom_text(
    data = xdf,
    aes("Actually read", act, label = topic),
    family = font_rc, size = 4, hjust = 1, nudge_x = -0.01, lineheight = 0.875
  ) +
  geom_text(
    data = xdf,
    aes("Say they\nwant covered", say, label = topic),
    family = font_rc, size = 4, hjust = 0, nudge_x = 0.01, lineheight = 0.875
  ) +
  scale_x_discrete(position = "top") +
  labs(
    x = NULL, y = NULL) +
  theme(axis.text.x = element_text(size = 12, face = "bold", color = "black")) +
  theme(axis.text.y = element_blank())+theme_bw(base_size = 22)
## Warning: Using size for a discrete variable is not advised.
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x,
## x$y, : font family not found in Windows font database