Create base funnel plot elements
funnelbase.RdCreates the common elements for a funnel plot including theme, scales, reference line, control limits, and caption. Used as a foundation for provider-specific funnel plots.
Usage
funnelbase(
xname,
yname,
xlim,
ylim,
caption,
legend.position,
legend.position.inside,
calc_cl
)Arguments
- xname
Character, x-axis label
- yname
Character, y-axis label
- xlim
Numeric vector of length 2, x-axis limits
- ylim
Numeric vector of length 2, y-axis limits
- caption
Character, plot caption
- legend.position
Character or numeric vector, legend position
- legend.position.inside
Numeric vector of length 2, position for internal legend
- calc_cl
Function that calculates control limits
Examples
if (FALSE) { # \dontrun{
library(ggplot2)
# Simple example
p <- ggplot(data = data.frame(x = 1:10, y = 1:10)) +
funnelbase(
xname = "Sample Size",
yname = "Rate",
xlim = c(0, 10),
ylim = c(0, 10),
caption = "Example funnel plot",
legend.position = "top",
legend.position.inside = c(0.85, 0.1),
calc_cl = function(x, p) p * x # Example control limit function
)} # }