Search code examples
rscientific-notation

Remove Scientific Notation from R plot


I am trying to remove scientific notation from the x-axis of the histogram. options(scipen=999) did not work.

Thank you for the help.

Seperate Lot into different blocks

hist(CatLotData2$'LOT SIZE')

CatLotData2$LotCat <-cut(CatLotData2$'LOT SIZE',
    c(0,1000,2000,3000,4000,5000,6000,7000,8000,9000,10000,12500,15000,17500,Inf))

##I have tried several options to remove scientific notation from the histogram.Below is what I have tried and failed.

plot(CatLotData2$LotCat)

## What I have tried to use and failed.
options(scipen = 999)

options("scipen"=0, "digits"=5)

format(1e03, scientific=FALSE) ## creates output on separate chart 
format(3e03, scientific=FALSE)
format(4e03, scientific=FALSE)

plot(CatLotData2$LotCat)

enter image description here


Solution

  • The issue is with cut. Use the dig.lab to adjust the digits

    CatLotData2$LotCat <-cut(CatLotData2$'LOT SIZE',
    c(0,1000,2000,3000,4000,5000,6000,7000,8000,9000,10000,12500,
            15000,17500,Inf), dig.lab = 10)