Generate a prediction plot of unmixed spread using isobands or contour lines
Source:R/PredIsobandPlot.R
PredIsobandPlot.RdThis function creates a ggplot-based visualization of predicted unmixed spread using either pseudo-color isobands or contour lines. It supports multiple axis scaling methods (Linear, Log10, Arcsinh), and optionally overlays population labels based on an intensity matrix.
Usage
PredIsobandPlot(
grid,
x_scale,
y_scale,
x_cofactor,
y_cofactor,
x_label,
y_label,
x_min,
x_max,
y_min,
y_max,
mode,
legend_show = TRUE,
label_population = NA,
intensity_matrix = NA
)Arguments
- grid
A data frame containing columns
x,y, andz, representing the grid coordinates and predicted values.- x_scale
A character string specifying the x-axis scale. Must be one of
"Linear","Log10", or"Arcsinh".- y_scale
A character string specifying the y-axis scale. Must be one of
"Linear","Log10", or"Arcsinh".- x_cofactor
A numeric value used for Arcsinh transformation on the x-axis. Ignored for other scales.
- y_cofactor
A numeric value used for Arcsinh transformation on the y-axis. Ignored for other scales.
- x_label
A character string for the x-axis label.
- y_label
A character string for the y-axis label.
- x_min
Minimum value for the x-axis.
- x_max
Maximum value for the x-axis.
- y_min
Minimum value for the y-axis.
- y_max
Maximum value for the y-axis.
- mode
A character string specifying the plot mode. Must be either
"Pseudo-color"or"Contour line".- label_population
Optional character vector specifying population names to label on the plot.
- intensity_matrix
Optional matrix or data frame containing intensity values for labeling populations. Must include rows named by
x_labelandy_label.- legned_show
Logical; whether to show the legend. Default is
TRUE.
Examples
if (FALSE) { # \dontrun{
grid <- expand.grid(x = seq(0, 1000, length.out = 50),
y = seq(0, 1000, length.out = 50))
grid$z <- with(grid, exp(-((x - 500)^2 + (y - 500)^2) / 1e5))
PredIsobandPlot(grid, x_scale = "Linear", y_scale = "Linear",
x_cofactor = 5, y_cofactor = 5,
x_label = "X", y_label = "Y",
x_min = 0, x_max = 1000,
y_min = 0, y_max = 1000,
mode = "Pseudo-color")
} # }