[R] Removing axes / frame from plot()

Duncan Murdoch
2007-11-11T16:58:10Z

On 11/11/2007 11:49 AM, Alex Park wrote:
> R Help
>
> Feel sure there is a simple answer to this but answer has eluded me so far.
>
> NB. Using R 2.6.0.
>
> I am plotting a simple chart using plot():
>
> plot(df, ylim=c(as.numeric(min(df)), as.numeric(max(df))),
col="OliveDrab",
> xlab="", ylab="")
>
> What I would like to do is have this chart appear such that there is only
an
> x and a y axis. I do not want a frame around my plot.
>
> First I tried:
>
> axis(side=2, xact="n"); axis(side=3, yact="n")
>
> but this didn't work.
>
> Then I looked up:
>
> ?plot.default
>
> In here there is an argument called 'frame.plot' which is described
as "a
> logical indicating whether a box should be drawn around the plot."
>
> I tried:
>
> plot(df, ylim=c(as.numeric(min(df)), as.numeric(max(df))),
> col="OliveDrab",xlab="", ylab="",
frame.plot=FALSE)
>
> but got an error message:
>
> "plot.frame" is not a graphical parameter

I think you mistyped the parameter as plot.frame (as in the error
message), not frame.plot.

By the way, a quicker way to specify the ylim is ylim=range(df).

Duncan Murdoch
>
> Also, I looked up:
>
> ?par
>
> But it seems there is no parameter in here to control plot.frame.
>
> Any ideas on this as I seem to have exhausted my options.
>