Skip to contents

this function plots a map of the beta coefficients for a selected column (aka species). For this function to work, the coordinates supplied to gwl_fit() must be named "Lat" and "Long". The function is not bulletproof yet but is added here to reproduce the maps from the original publication.

[Experimental]

Usage

plot_gwl_map(x, column, crs = 4326)

Arguments

x

a gwlfit object returned by gwl_fit().

column

the name of a variable to be plotted on the map. Must be quoted. for instance "NEB.MIN"

crs

the crs projection for the map (default is mercator WGS84). See sf::st_crs()

Value

a ggplot object

Examples


data(Amesbury)
  
distance_matrix <- compute_distance_matrix(Amesbury$coords[1:30,], add.noise = TRUE)
  
my.gwl.fit <- gwl_fit(bw= 20,
                      x.var = Amesbury$spe.df[1:30,],
                      y.var = Amesbury$WTD[1:30],
                      dist.mat = distance_matrix,
                      adaptive = TRUE,
                      kernel = "bisquare",
                      alpha = 1,
                      progress = TRUE)
                        
if(requireNamespace("maps")){
    plot_gwl_map(my.gwl.fit, column = "NEB.MIN")
  }
#> Loading required namespace: maps