plot - How can we keep the default axis values but just turn them to percentages in R? -
i'm wondering how can keep default y-axis values r in plot turn them percentages? specifically, if need use axis() how should specify "at =" in axis() keep default tickmarked values?
an example here:
x = rbinom(10, 100, .7) plot(x) here thought might work didn't:
plot(x, yaxt = "n") tk = par("yaxp") axis(2, @ = seq(tk[1], tk[2], l = tk[3]), labels = paste0(seq(tk[1], tk[2], l = tk[3]), "%"))
this job you:
plot(x, yaxt="n") axis(2, at=axticks(2), labels=paste0("%", axticks(2))) below, can see result of plot(x) , solution above side side:
set.seed(123) x = rbinom(10, 100, .7) plot(x) plot(x, yaxt="n") axis(2, at=axticks(2), labels=paste0("%", axticks(2))) 

Comments
Post a Comment