Reputation: 75
I just want to have # ###
numbers in the axes on my plot. For example, not 3500000
, 3000000
, but 3 500 000
and 3 000 000
. Any idea how to do that?
Upvotes: 1
Views: 434
Reputation: 1438
Use the prettyNum
function with big.mark = " "
and use them as labels in the axis
call. To remove the default axis labels, you can use xaxt="n"
for the x-axis, yaxt="n"
for the y-axis or axes=FALSE
for both axes.
Example:
plot(rnorm(1e4),xaxt = "n")
axis(1,at = labs <- pretty(par()$usr[1:2]),labels = prettyNum(labs,big.mark = " "))
Upvotes: 1