plot_sKDE: Using the result obtained by the evaluation of the functions...

Description Usage Arguments Value Examples

Description

Using the result obtained by the evaluation of the functions sKDE() or sKDE_without_c(), the function plot_sKDE() creates a visualization of the kernel density estimates.

Usage

1
2
3
4
plot_sKDE(smooth, breaks, polygon, coord, alpha_coords = 0.8,
  size_coords = 0.8, many_points = FALSE, colContour = "white",
  colPoints = "dodger blue", title, contour = TRUE, round = 2,
  text_size = 22)

Arguments

smooth

result from sKDE() or sKDE_without_c();

breaks

breaks for the legend (seq(min(smooth$Z)*.95,max(smooth$Z)*1.05,length=21) by default);

polygon

polygon on which data points lie;

coord

coordinates (long, lat) of data points;

alpha_coords

transparency for data points (.8 by default);

size_coords

size for data points (.8 by default);

many_points

if TRUE, @coord must be the result of condense() (package bigvis). It is helpful when there are too many points to display (FALSE by default);

colContour

colour of the contour of the polygon ("white" by default);

colPoints

colour of the data points ("dodger blue" by default);

title

title (if provided) to give to the plot;

contour

if FALSE, contour are not plotted (TRUE by default);

round

round value for the legend (2 by default);

text_size

text size (22 by default).

Value

a ggplot2 plot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(acci)
# Estimation with correction
smoothed_fin <- sKDE(U = acci$finistere$points, polygon = acci$finistere$polygon,
    optimal=TRUE, parallel = FALSE)
# Estimation without correction
    smoothed_fin_nc <- sKDE_without_c(U = acci$finistere$points, polygon = acci$finistere$polygon,
    optimal=TRUE)
p_acci_fin <- plot_sKDE(smooth = smoothed_fin,
    coord = acci$finistere$points,
    alpha_coords = .8,
    size_coords = 1,
    breaks = seq(min(smoothed_fin$ZNA, smoothed_fin_nc$ZNA,na.rm=TRUE)*.95,
    max(smoothed_fin$ZNA, smoothed_fin_nc$ZNA,na.rm=TRUE)*1.05, length=21),
    polygon = acci$finistere$polygon, round = 3, colContour = "black") +
ggtitle("With correction") +
coord_equal()
print(p_acci_fin)

ripleyCorr/kdeborder documentation built on May 26, 2019, 1:33 a.m.