ggplot2 y-axis ticks not showing up on a log scale

后端 未结 1 1073
被撕碎了的回忆
被撕碎了的回忆 2021-01-21 11:07

I am trying to use ggplot2 to create a boxplot graph but I am having trouble getting the ticks to show up as it does in the examples of the ggplot2 webiste.

Here is som

相关标签:
1条回答
  • 2021-01-21 11:41

    I'm assuming that you are using the new 0.9.0 version of ggplot2, which underwent a large amount of changes. This happens to be one of them, I believe.

    If I recall correctly, enough people complained about the exponential format being the default, that this was changed. As per the transition guide you can achieve the same effect via:

    library(ggplot2)
    library(scales)
    ggplot(fruits, aes(fruit, taste) ) +  
        geom_boxplot() + 
        scale_y_log10(breaks = trans_breaks('log10', function(x) 10^x),
                      labels = trans_format('log10', math_format(10^.x)))
    
    0 讨论(0)
提交回复
热议问题