data I am trying to log transform the axis on the bottom of the graph, but I think coord_flip()
is somehow inhibiting this. I've tried using scale_y_continuous(trans = "log10")
, coord_trans(y = "log10")
and scale_y_log10()
. None of these worked to log transform that axis. This is the code with no transformation and the output.
data set in excel dput(df) Plot with no transformation
Any help is much appreciated!
p1 <-ggplot(data = df,
aes(x = Quintile, y = OR, ymin = Lower, ymax = Upper))+
geom_pointrange(aes(col = Quintile))+
geom_hline(aes(fill = Quintile), yintercept = 1, linetype = 2)+
labs(x = "Treatment", y = "OR and 95% CI")+
geom_errorbar(aes(ymin = Lower, ymax = Upper, col = Quintile), width = 0.5)+
facet_wrap(~TX, strip.position = "left", nrow = 5,scales = "free_y")+
theme_classic()+
theme(plot.title = element_text(size = 16, face = "bold"),
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
axis.text.x = element_text(face = "bold"),
axis.title = element_text(size = 12, face = "bold"),
strip.text.y = element_text(hjust = 0,vjust = 1,angle = 180, face = "bold"),
legend.position = "NULL")+
coord_flip()
p1