[R] pairs plot
Bert Gunter
bgunter@4567 @end|ng |rom gm@||@com
Thu Feb 6 17:15:45 CET 2025
Possibly because:
panel.hist is not an existing R function -- you have to first create
it so pairs() can use it. ?pairs shows you how in the Help examples,
i.e.
panel.hist <- function(x, ...)
{
usr <- par("usr")
par(usr = c(usr[1:2], 0, 1.5) )
h <- hist(x, plot = FALSE)
breaks <- h$breaks; nB <- length(breaks)
y <- h$counts; y <- y/max(y)
rect(breaks[-nB], 0, breaks[-1], y, col = "cyan", ...)
}
Cheers,
Bert
On Thu, Feb 6, 2025 at 8:01 AM Ranjan Maitra via R-help
<r-help using r-project.org> wrote:
>
> According to the help for pairs, the diag.panel function is supposed to
> take a panel.hist as in:
>
> pairs(USJudgeRatings[1:5], panel = panel.smooth,
> cex = 1.5, pch = 24, bg = "light blue", horOdd=TRUE,
> diag.panel = panel.hist, cex.labels = 2, font.labels = 2)
>
> Error: object 'panel.hist' not found
>
> I know that this used to work in the past so I wonder if this was changed and the documentation was not corrected.
> Anyway, what is the current way of doing this?
>
> Many thanks and best wishes,
> Ranjan
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list