Force R to stop plotting abbreviated axis labels - e.g. 1e+00 in ggplot2

前端 未结 7 1338
遥遥无期
遥遥无期 2020-11-28 04:09

In ggplot2 how can I stop axis labels being abbreviated - e.g. 1e+00, 1e+01 along the x axis once plotted? Ideally, I want to force R to display the actual valu

相关标签:
7条回答
  • 2020-11-28 04:52

    There is a solution that don't require scales library.

    You can try:

    # To deactivate scientific notation on y-axis:
    
        p + scale_y_continuous(labels = function(x) format(x, scientific = FALSE))
    
    # To activate scientific notation on y-axis:
    
        p + scale_y_continuous(labels = function(x) format(x, scientific = TRUE))
    
    # To deactivate scientific notation on x-axis:
    
        p + scale_x_continuous(labels = function(x) format(x, scientific = FALSE))
    
    # To activate scientific notation on x-axis:
    
        p + scale_x_continuous(labels = function(x) format(x, scientific = TRUE))
    
    0 讨论(0)
提交回复
热议问题