# create data sets
ylabel <- c("first","second","third",
"fourth","fifth","Sixth")
x1 <- c(1,2,4,5,3,2)
x2 <- c(4,3,6,7,5,4)
datamain <- data.frame(ylabel,x1,x2)
# import ggplot2, ggalt and tidyverse
library(ggplot2)
library(ggalt)
library(tidyverse)
# Draw dumbbell plot
ggplot() +
geom_dumbbell(data = datamain, aes(y = ylabel,
x = x1,
xend = x2),
size = 1.5, color = "blue", size_x = 7,
size_xend = 7, colour_x = "green",
colour_xend = "yellow")