This function preserves the original POPMAPS plotting interface
for compatibility with POPMAPS 1.03-era scripts. New analyses should use
plot_popmaps() or write_popmaps_plot(), which provide terra-based map
output, manuscript-style defaults, optional background rasters, and PNG
export. popmap_viz() can draw hard boundaries only or hard boundaries
with ancestry probabilities. Pie charts representing empirical ancestry
patterns are drawn at sampling sites.
Usage
popmap_viz(
pop_raster_list = "",
input_locs = "",
input_raster = "",
maptype = c("bound", "ancestry"),
pie_radius = 0.15,
boundary_width = -0.015,
crs = "+init=epsg:5070"
)Arguments
- pop_raster_list
An R object resulting from executing
popmaps().- input_locs
An R object with rows as empirical sites and columns as: column 1, site name; column 2, decimal longitude or x-coordinate; column 3, decimal latitude or y-coordinate; columns 4 through n, ancestry coefficients for each genetic axis. The function depends on this precise column order; see the example data
hija_struc.- input_raster
An R RasterLayer object defining the geographic extent for the spatial interpolation.
- maptype
A string, either
"bound"or"ancestry", that defines the map type."bound"draws hard boundaries only."ancestry"draws hard boundaries and the maximum ancestry-probability surface.- pie_radius
A numeric value modifying the size of the pie charts depicting empirical ancestry coefficients drawn on top of the probability surface.
- boundary_width
Retained for compatibility with POPMAPS 1.03. Boundary buffering previously depended on retired spatial packages and is no longer applied.
- crs
A string defining a mapping projection. The historical default is an Albers Equal Area Conic projection used by older POPMAPS examples.
References
Massatti R & Winkler DE. (2022) Spatially explicit management of genetic diversity using ancestry probability surfaces. Methods in Ecology and Evolution. http://dx.doi.org/10.1111/2041-210X.13902
Examples
if (FALSE) { # \dontrun{
ex_raster <- raster::aggregate(hija_raster,fact=16) #Cells in embedded raster are aggregated to reduce computation time
pp <- popmaps(input_raster=ex_raster,input_locs=hija_struc,empirical_pt_dist=5,num_sites=15,num_tested=4,popmod=-0.05,threshold=0,surface='G')
popmap_viz(pop_raster_list=pp,input_locs=hija_struc,input_raster=ex_raster,maptype='ancestry',crs="+init=epsg:5070",boundary_width=-0.01)
} # }