# [R] Multiple plots with single box

From: Giovanni Petris <GPetris_at_uark.edu>
Date: Tue, 18 Dec 2007 17:21:42 -0600 (CST)

Hello,

I am trying to display some harmonic functions in a plot. The kind of display I have in mind is like the one that cn be obtained by a call to plot.ts with plot.type = "multiple". The only difference is that I want a single box containing all the plots instead of one box per plot. I thought box(which = "outer") would have done the job, but it didn't.

Below is the code I have used so far. (R 2.5.1, I know, I know...)

Any help is greatly appreciated.

Giovanni

### Plot harmonic functions
n <- 6 # even
omega <- 2 * pi / n

par(mfrow = c(n - 1, 1), mar = c(0, 5.1, 0, 5.1), oma = c(3, 1, 2, 1)) for (i in 1:(n/2 - 1)) {

curve(cos(x * i * omega), 0, n, ylim = c(-1.1, 1.1), ylab = "", axes = FALSE)     points(1:n, cos(i * omega * 1:n))
axis(2); abline(h = 0, col = "lightgrey")     curve(sin(x * i * omega), 0, n, ylim = c(-1.1, 1.1), ylab = "", axes = FALSE)     points(1:n, sin(i * omega * 1:n))
axis(4); abline(h = 0, col = "lightgrey") }
curve(cos(x * (n/2) * omega), 0, n, ylim = c(-1.1, 1.1), ylab = "", axes = FALSE) points(1:n, rep(c(-1,1), n/2))
axis(1); axis(2); abline(h = 0, col = "lightgrey")

```--

Giovanni Petris  <GPetris_at_uark.edu>
Department of Mathematical Sciences
University of Arkansas - Fayetteville, AR 72701
Ph: (479) 575-6324, 575-8630 (fax)
http://definetti.uark.edu/~gpetris/

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help