Keep the default axis values but just turn them to percentages

Viewed 34

I'm wondering how I can keep the default y-axis values by R in my plot but just turn them to percentages? Specifically, if we need to use axis() how should we specify "at =" in axis() to keep the default tickmarked values?

An example is here:

x = rbinom(10, 100, .7)
plot(x)

Here is what I thought might work but didn't:

plot(x, yaxt = "n")
tk = par("yaxp")
axis(2, at = seq(tk[1], tk[2], l = tk[3]), labels = paste0(seq(tk[1], tk[2], l = tk[3]), "%"))
1 Answers
Related