Why is the transformation of my y-axis to logarithmic scale not showing the correct values in a column plot made with ggplot2?

Viewed 37

I am making a plot of columns whose values are very far apart from each other. To solve this, I chose to use logarithmic scaling on the y-axis with the function scale_y_continuous(trans = 'log10'). But in doing so, the values displayed on the y-axis are totally different from the real ones. How can I solve this?

library(ggplot2)

Place <- c("A", "B", "C")
Class <- c("a", "b", "c")
Value <- c(1,2,3,10,20,30,100,200,300)

DF <- expand.grid(Place = Place,
            Class = Class)

DF$Value <- Value 

ggplot(data = DF,
     aes(x = Place,
         y = Value,
         group = Class)) +
 geom_col(aes(fill = Class)) +
 geom_text(aes(label = Value),
           position = position_stack(vjust = 0.5)) +
 scale_y_continuous(trans = 'log10')

enter image description here enter image description here

0 Answers
Related