Set ylim in a log10 scale_y_continuous in R

Viewed 246

When I set the ylim within the scale_y_continousus, the bar plots disappear, I have tried changing the minimum and maximum but there is always some bars missing. Why is this? I would like to adjust it to 10^4 to 10^7.

A = c(1,2,3,4,5,6,7)
B= c(33045, 970250, 1870125, 259625, 3838750, 962333, 2272916.667)
sd = c(8538, 319023, 1538958, 27753, 1602186, 561207, 322322)
df = data.frame(A,B,sd)

ggplot(df, aes(x=A, y=B)) +
    geom_bar(colour="black", stat="identity", fill="grey")  +
  geom_errorbar( aes(x=A, ymin=B-sd, ymax=B+sd), width=0.2, colour="black", alpha=0.9, size=0.5) +
  scale_x_continuous(breaks = 1:7)+
  theme_classic()+
  theme(strip.placement = "outside", 
        axis.text.x = element_text( size = 12 ))+
  scale_y_continuous(trans='log10', limits = c(10000,10000000))

enter image description here

0 Answers
Related