I want to create a lollipop graph something like given below:

using the following code
# Library
library(tidyverse)
# Create data
df1 <-
data.frame(
x = c(2014, 2014, 2017, 2017, 2021, 2021)
, y = c(1, -1, 1, -1, 1, -1)
)
df1
# plot
ggplot(data = df1, aes(x = x, y = y)) +
geom_segment(aes(x = x, xend = x, y = 0, yend = y)) +
geom_segment(aes(x = 2014, xend = 2021, y = 0, yend = 0)) +
geom_point(
size = 5
, color = "red"
, fill = alpha("orange", 0.3)
, alpha = 0.7
, shape = 21
, stroke = 2
) +
theme_void()

Here's a possible approach which could be adapted to suit specific requirements...
You may need to adjust the parameters to suit your data and graphical device.
The balance of work done within the call to
ggplotand the dataframe is fairly arbitrary; the setting of y and x coordinates for the various elements of the diagram could be set in the data frame.Created on 2023-06-24 with reprex v2.0.2