library(ggplot2)
library(ggprism)
# Sample data set
set.seed(1)
df <- data.frame(x = LETTERS[1:10],
y = sample(20:35, 10, replace = TRUE))
df$pvalue <- runif(nrow(df))
p1 <- ggplot(df, aes(x = x, y = y)) +
geom_segment(aes(x = x, xend = x, y = 0, yend = y),color = "gray", lwd = 1.5) +
geom_point(aes(color = pvalue),size = 4, pch = 19, bg = 4) +
labs(y=expression( -log[10](p.value)), x= "") +
ggtitle("AA") +
scale_color_gradient(low="blue", high="red") +
scale_x_discrete(expand = c(0.05,0.05)) +
scale_y_continuous(expand = c(0.01,0.01),limits = c(0,35))
p1

p1 + theme_prism(base_size = 14) +
theme(legend.position = c(1,0.6),
legend.direction = "vertical",
legend.spacing.x = unit(0.1, 'cm'),
#legend.spacing.y = unit(0.2, 'cm'),
legend.title.align = 0,
legend.key.size = unit(.5, "cm"),
legend.text = element_text(colour="black", size=18,
face="plain"),
legend.title = element_text(colour="black", size=18,
face="plain"),
legend.background = element_blank(),
legend.key = element_rect(colour = NA, fill = NA),
#legend.key.height=unit(0.5,"line"),
#legend.key.width=unit(0.7,"line"),
#legend.margin=margin(5,5,5,5),
#legend.justification = c(0.5, 0.7),
#legend.box.margin=margin(0,0,0,0),
panel.background = element_blank(),
panel.border = element_rect(colour = NA, fill=NA, size=1),
axis.line = element_line(size = 0.5, color = "black"),
panel.grid = element_blank(),
plot.margin = unit(c(0,2,0,0), "cm"),
axis.text.x = element_text(size= 18, color = "black",family = "sans",hjust = 0.5, angle = 0),
axis.text.y = element_text(size= 18, color = "black",family = "sans",vjust = 0.5,hjust =1),
axis.title = element_text(size=18, color = "black",family = "sans",face = "bold"),
axis.ticks = element_line(size= 0.5),
axis.ticks.length = unit(3, "pt"))

################output
ggsave(paste0(Sys.Date(),"-point_line_Lollipop.tiff"), plot = last_plot(),
device = "tiff", path = NULL,
scale = 1, width = 35, height = 15, units ="cm",dpi = 300, limitsize = TRUE)