plot.strata: Plot Method for Stratified Survey Design Objects
Description
Visualises a stratified design. The "2d" mode draws a histogram with
the fitted density overlaid and the strata shaded; "3d" and
"interactive" render plotly views of the Neyman cost surface.
Usage
# S3 method for strata
plot(
x,
type = c("2d", "3d", "interactive"),
data = NULL,
n_pts = 512L,
alpha = 0.25,
palette = c("#4E79A7", "#F28E2B", "#E15759", "#76B7B2", "#59A14F",
"#EDC948", "#B07AA1", "#FF9DA7", "#9C755F"),
main = NULL,
show_info = TRUE,
...
)
Value
Invisibly returns x for "2d"; a plotly widget
for "3d" and "interactive".
Arguments
x
A "strata" object.
type
"2d" (default), "3d", or "interactive".
data
Optional numeric vector of population values.
n_pts
Integer. Density grid size. Default 512L.
alpha
Numeric. Stratum fill transparency. Default 0.25.
palette
Character vector of stratum colours (recycled).
main
Character. Plot title (auto-generated if NULL).
show_info
Logical. Overlay a per-stratum information box on the
"2d" plot. Default TRUE.
if (FALSE) {
set.seed(1); y <- rgamma(2000, shape = 2, rate = 0.5)
res <- strata.data(y, h = 4, n = 400)
plot(res)
plot(res, type = "3d")
plot(res, type = "interactive")
}