I'm trying to change the format of y axis in R base plot i.e. plot(x, y, type='l'). I have y values as numeric and I want values on axis to appear as %. How can I do that?
CodePudding user response:
x <- 1:3
y <- 1:3 / 4
plot(x, y, type = "l")
plot(x, y, type = "l", yaxt = "n")
ylbl <- axTicks(side=2)
ylbl
# [1] 0.3 0.4 0.5 0.6 0.7
axis(2, at = ylbl, labels = paste(100*ylbl, "%"))