0

When I do a boxplot diagram with the R boxplotfunction, this function prints the y-axis automatically.

boxplot(x=DF$Baseline.Investment, xlab="Baseline.Investment",col=c('green'))

I want the y axis limits changed to millions. Could someone help with this question? Thanks in advance.

enter image description here

j__carlson
  • 1,346
  • 3
  • 12
  • 20
smrithi
  • 3
  • 2

1 Answers1

0

The easy way

set.seed(42)
x <- rlnorm(100, 12, 2)
boxplot(x/1e6, ylab="Amount in Millions")

Boxplot

If you want more control over the axis labels, create your own axis:

boxplot(x, yaxt="n", ylab="Amount in Millions")
axis(2, c(0, 5e6, 1e7, 1.5e7), c("0", "5", "10", "15"), las=1)
dcarlson
  • 10,936
  • 2
  • 15
  • 18