0

I have made a bar graph and would like it to have a log-scaled y axis. However, when I try to add the code for this, it for some reason inverses most of the bars... Can anyone explain why this may be and how to remedy this?

The code I use is as follows:

Graph1 <- ggplot(Data, aes(x=Temp, y=Mean, fill=Exposure)) + 
  geom_bar(position=position_dodge(), stat='identity', color="black",) + 
  xlab("Temperature (°C)") + 
  ylab("Cd concentration (µg/g)") + 
  facet_wrap(.~Day, scales="free_y", labeller=labeller(Day=supp.labsDAY), nrow = 1, ncol = 4)+ 
  geom_errorbar( aes(x=Temp, ymin=Mean-SEM, ymax=Mean+SEM),  width = 0.2, position=position_dodge(.9))

Graph1+ scale_y_log10()
Jilber Urbina
  • 58,147
  • 10
  • 114
  • 138
Emily
  • 25
  • 3
  • A log y-axis has no origin because `log(0)` isn't defined. Thus, a reasonable alternative is to set the baseline at 1 and anything smaller than 1 would appear as an inverted bar. – teunbrand Mar 01 '21 at 21:01
  • Refer to the answers for [this](https://stackoverflow.com/questions/9502003/bar-plot-with-log-scales) question. I hope this helps a bit. – Wouterbez Mar 01 '21 at 21:24
  • You might consider using the `pseudo_log` transformation here, which allows a zero baseline, with a gradual transition into log transformation. But it seems inadvisable to use a bar plot on a stacked log scale, since bars would change in apparent size just on account of sorting order. This will be prone to misinterpretation. – Jon Spring Mar 01 '21 at 21:31

0 Answers0