Dear all,
I would like to highlight one of value on X axis with color like in this graph,
Some people recommend me to use, geom_vline, but it was not my target.
Could you please tell me what the package to make it?
here are my script
data <- read.csv("test.csv", header=T)
library(tidyverse)
library(ggplot2)
data %>%
mutate(row = row_number()) %>%
pivot_longer(cols = -row, values_drop_na = TRUE) %>%
ggplot(aes(value)) + aes(row, value, color=name) +
geom_jitter()+ geom_hline(yintercept=1.4, linetype="dashed") + xlab("") +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black")) + scale_color_manual(values = "purple") +
theme(axis.ticks.x = element_blank(),axis.text.x = element_blank()) + theme(legend.title=element_blank()) +
theme(axis.title.x = element_text(size = 15)) +
theme(axis.title.y = element_text(size = 15)) +
geom_vline(xintercept = 60, linetype="dotted",color = "black", size=1) + geom_vline(xintercept = 300, linetype="dotted", color = "black", size=1) + geom_rect( aes(xmin = 30, xmax = 50), ymin = -Inf, ymax = Inf, color="grey", fill="grey", alpha= 0.3)
Thank you so much.