Re: [R] Changing default plot behaviour

From: <>
Date: Wed, 09 Apr 2008 16:25:15 +0100

> How would I make the default behaviour of my plots produce output such
> as the following (i.e. tick marks inside on all axes, labels only on two
> (arbitrary?) sides) without needing the five additional commands each
> time?
> plot(1:10, axes=FALSE)
> axis(1, tcl=0.5)
> axis(2, tcl=0.5)
> axis(3, tcl=0.5, labels=FALSE)
> axis(4, tcl=0.5, labels=FALSE)
> box()

Use a custom plotting function, e.g.
myplot <- function(..., sidesforlabels)

   #sidesforlabels should be a numeric vector containing the sides that you want labels on

   plot(..., axes=FALSE)
   for(i in 1:4)

      axis(i, labels=i %in% sidesforlabels)    }

myplot(1:10, sidesforlabels=1:2)


Mathematical Sciences Unit

ATTENTION: This message contains privileged and confidential inform...{{dropped:20}} mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 09 Apr 2008 - 15:57:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 Apr 2008 - 16:30:27 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive