Do not want scientific notation on plot axis

前端 未结 7 1882
死守一世寂寞
死守一世寂寞 2020-11-30 22:12

I regularly do all kinds of scatter plots in R using the plot command.

Sometimes both, sometimes only one of the plot axes is labelled in scientific not

7条回答
  •  清歌不尽
    2020-11-30 22:38

    You can use the axis() command for that, eg :

    x <- 1:100000
    y <- 1:100000
    marks <- c(0,20000,40000,60000,80000,100000)
    plot(x,y,log="x",yaxt="n",type="l")
    axis(2,at=marks,labels=marks)
    

    gives :

    enter image description here

    EDIT : if you want to have all of them in the same format, you can use the solution of @Richie to get them :

    x <- 1:100000
    y <- 1:100000
    format(y,scientific=FALSE)
    plot(x,y,log="x",yaxt="n",type="l")
    axis(2,at=marks,labels=format(marks,scientific=FALSE))
    

提交回复
热议问题