I have the following two questions: (1) I want to get the label to be between two ticks. My original thought was to add the secondary ticks and remove the primary ticks, but axis.minor.ticks.length.y doesn't work (2) Add stat_summary points at the legend Thank you very much for answering your questions!
Here is the code and figure:
library("ggplot2")
dt <- data.frame(
ca = rep(c("Oesophageal cancer", "Gastric cancer", "Colorectal cancer"), 3),
var1 = c(1:3, -4:-6, 7:9),
var2 = rep(LETTERS[1:3], 3)
)
dt %>%
ggplot(aes(var1, ca, fill = var2))+
geom_bar(stat="identity", width=0.8)+
stat_summary(fun=sum, geom="point",colour="grey40", fill="grey40", shape=20, size=2)+
geom_vline(xintercept=0, colour="grey30", linetype="dotted")+
theme(
axis.minor.ticks.length.y = rel(0.5)
)
Objective: Change Figure 1 to Figure 2 style