I am drawing a graph using ggplot2 in R for two objects called A and B. My code is
ggplot(test_error_bar_14_10_21, aes(x=levels, y=len, colour=index, group=index))
geom_errorbar(aes(ymin=len-ci, ymax=len ci), width=.03)
geom_line()
geom_point(size=3, shape=21, fill="white") # 21 is filled circle
xlab("Percentage(%population)")
ylab("Treatment on new cases")
scale_colour_hue(name="Type of indices", # Legend label, use darker colors
breaks=c("doses/population", "death/population"),
labels=c("A", "B"),
l=40) # Use darker colors, lightness=40
ggtitle("The Effect of different vaccines rates on \nA and B")
coord_flip() #rotate the graph (https://ggplot2.tidyverse.org/reference/coord_flip.html)
expand_limits(y=0) # Expand y range
scale_y_continuous(breaks=0:20*4) # Set tick every 4
theme_bw()
theme(legend.justification=c(1,0),
legend.position=c(1,0)) # Position legend in bottom right
The result is
As can be seen, I have the negative results on x-axis, so what I should do to also mark the negative interval on x-axis ? I saw a post