Here's an example
data(swiss)
panel.bxp <- function(x, ...)
{
usr <- par("usr"); on.exit(par(usr))
par(usr = c(0, 2, usr[3:4]))
boxplot(x, add=TRUE)
}
pairs(swiss, diag.panel = panel.bxp, text.panel = function(...){})
You overlooked the `add=TRUE' argument, it seems.
On Sun, 27 Jul 2003, Masayoshi Hayashi wrote:
> I tried the following command to produce boxplot of diagonals in pairs
> function:
>
> > pairs(t1.5,diag.panel=boxplot)
> Error in pairs.default(t1.5, diag.panel = boxplot) :
> The panel function made a new plot
>
> The graphics device draws two graphs, one with a rectangle at (1,1) in 7x7
> layout and the other with boxplot(t1.5$wind) at (1,2).
>
> pairs function help file has a similar example with hist function but I am
> stuck with producing boxplot version.
>
> Thanks for your time and reply in advance.
>
> The below is t1.5 data from Applied Multivariate Statistical Analysis 5th,
> Johnson and Wichern, p40 Table 1.5.
>
> wind radiation co no no2 o3 hc
> 8 98 7 2 12 8 2
> 7 107 4 3 9 5 3
> 7 103 4 3 5 6 3
> 10 88 5 2 8 15 4
> 6 91 4 2 8 10 3
> 8 90 5 2 12 12 4
> 9 84 7 4 12 15 5
> 5 72 6 4 21 14 4
> 7 82 5 1 11 11 3
> 8 64 5 2 13 9 4
> 6 71 5 4 10 3 3
> 6 91 4 2 12 7 3
> 7 72 7 4 18 10 3
> 10 70 4 2 11 7 3
> 10 72 4 1 8 10 3
> 9 77 4 1 9 10 3
> 8 76 4 1 7 7 3
> 8 71 5 3 16 4 4
> 9 67 4 2 13 2 3
> 9 69 3 3 9 5 3
> 10 62 5 3 14 4 4
> 9 88 4 2 7 6 3
> 8 80 4 2 13 11 4
> 5 30 3 3 5 2 3
> 6 83 5 1 10 23 4
> 8 84 3 2 7 6 3
> 6 78 4 2 11 11 3
> 8 79 2 1 7 10 3
> 6 62 4 3 9 8 3
> 10 37 3 1 7 2 3
> 8 71 4 1 10 7 3
> 7 52 4 1 12 8 4
> 5 48 6 5 8 4 3
> 6 75 4 1 10 24 3
> 10 35 4 1 6 9 2
> 8 85 4 1 9 10 2
> 5 86 3 1 6 12 2
> 5 86 7 2 13 18 2
> 7 79 7 4 9 25 3
> 7 79 5 2 8 6 2
> 6 68 6 2 11 14 3
> 8 40 4 3 6 5 2
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595