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
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 at 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 at 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.
On 06.02.2025 04:32, Ranjan Maitra via R-help 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 foundFunction panel.hist is only defined in the example section of pairs. Best, Uwe Ligges> 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 at 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.