Closed mikemeredith closed 3 years ago
Oops, a bug: with layout=c(1,1)
or just 1 parameter, the functions should not touch par(mfrow...)
, so this code should work to produce histogram and density plot side by side:
par(mfrow=c(1,2))
hist(out$sims.list$foo)
densityplot(out, "foo")
... but it doesn't do that. I'll chase that up now.
That was a pre-existing bug, not connected to the new layout
argument. The call to par(oma=...)
causes the next plot to go top-left. I'll do a new pull request with the fix.
That now works. Try this:
example(jags)
par(mfrow=1:2)
scatter.smooth(employed ~ gnp)
abline(lm(employed ~ gnp), col='red')
densityplot(out, "beta")
traceplot
instead of densityplot
also works.
Thanks Mike, looks good.
Replace the
per_plot
argument intraceplot
anddensityplot
withlayout
, a length 2 vector specifying the number of rows and columns in the plot. (If a single value is provided, this is used for rows and columns.) The default is 3 x 3, the same as the oldper_plot=9
default, reduced if there are fewer parameters.The
plot.jagsUI
method keeps theper_plot
argument, which is effectively the number of rows, the number of columns being fixed at 2.Tested with output from Schaub & Kéry (in prep) in R 4.1.0 and R-devel.