0

I have a bar plot showing cell counts (in exponential) versus treatment. The code I use gives me an output scale from 0 till 10^7 but eating up everything below 10^7. I would like to have a custom scale ranging from 10^6 to 10^9 with breaks at 10^6, 10^7, 10^8, 10^9.

I have tried using setting the limits and breaks using scale_y_continous but that didn't help. My code is as follows:

ggplot(data = Zerohourdata) +
  geom_col(mapping = aes(x = AB.Treatment, y = cfumilli)) + 
  facet_wrap( ~ Plate.ID) + 
  scale_y_continuous(limits = c(10^6, 10^8), breaks = c(10^6, 10^7, 10^8))

Help?

r2evans
  • 141,215
  • 6
  • 77
  • 149
Domu
  • 9
  • 3
  • 2
    Welcome to SO! Please [edit] your question and add sample data to turn it into a [MCVE]. For R, there's some great advice at https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Frank Schmitt Aug 15 '19 at 16:30
  • Lacking your data, this code gives me a plot whose y-axis ranges from `1e+06` to `1e+08` (not sure why you're setting `8` if you are asking for `9`). – r2evans Aug 15 '19 at 16:35
  • Sorry, that is a mistake, it should be till 9. @FrankSchmitt Thank you! To both of you the data is as follows : Treatment::Count A::20000000 B::50000000 C::47142857 – Domu Aug 15 '19 at 16:48
  • If your data spans a few orders of magnitude, you might also try `scale_y_log10` or `scale_y_sqrt` or access them using `scale_y_continuous(trans = "log10")` etc. – Jon Spring Aug 15 '19 at 17:09
  • @JonSpring Thanks! That got things sorted. – Domu Aug 16 '19 at 13:32

0 Answers0