Skip to content

Thousand separator on axis

2 messages · Waldir Leôncio, Duncan Murdoch

#
Waldir Le?ncio wrote:
Sure:  just write a function to do it.  Assuming y is the only thing 
that varies,

myplot <- function(y) {

plot(y, yaxt = "n", ylab = "")
axis(2, at = y, labels = formatC(y, big.mark = " ", format = "d"), las=2)

}

then myplot(y) is all you need to type.   (If you want to be able to 
specify titles, etc., just include a ... arg to myplot.)

Duncan Murdoch