I am trying to develop a plot using ggplot.
df <- data.frame(
variable = c("1st", "2nd", "3rd", "4th"),
date_ = as.Date("2020-01-01", "2020-02-10", "2020-03-20", "2020-04-30"),
month = 1:4,
year = rep(2020, times = 4),
position = c(0.2, -0.2, 0.2, -0.2),
direction = c(1, -1, 1, -1),
text_position = c(0.22, -0.22, 0.22, -0.22),
x_ = c(5, 10, 15, 20)
)
status_levels <- c("Open", "first answer", "answeered", "resolved")
status_colors <- c("#0070C0", "#00B050", "#FFC000", "#C00000")
library(ggplot2)
plot <- ggplot(df, aes(x = x_, y = 0, col = variable, label = variable)) +
scale_color_manual(values=status_colors, labels=status_levels, drop = FALSE) +
theme_classic() +
geom_hline(yintercept=0,
color = "black", size=0.3) +
geom_segment(aes(y=position,yend=0,xend=x_), color='black', size=0.2) +
geom_segment(aes(x = 22, xend = 22.1, y = 0, yend = 0), arrow = arrow(length = unit(0.3, "cm")), size= 0.7, color = 'black') +
geom_point(aes(y=0), size=7) +
theme(axis.line.y=element_blank(),
axis.text.y=element_blank(),
axis.title.x=element_blank(),
axis.title.y=element_blank(),
axis.ticks.y=element_blank(),
axis.text.x =element_blank(),
axis.ticks.x =element_blank(),
axis.line.x =element_blank(),
legend.position = "bottom") +
geom_text(aes(y=text_position,label=variable),size=4)
plot
But is it possible to erase off the lines in the edges i.e the horizontal line will start from the blue bubble and will end before the arrow?