# \donttest{
# Plug-in HDR estimator for spherical model 9 in HDiR package
set.seed(1)
sample=rspheremix(1000, model =9)
sphere.plugin.hdr(sample,tau=0.8,col="red")
#Plug-in HDR estimator for data on earthquakes on Earth
if (requireNamespace("ggplot2", quietly = TRUE)) {
library(ggplot2)
}
if (requireNamespace("maps", quietly = TRUE)) {
library(maps)
}
if (requireNamespace("mapproj", quietly = TRUE)) {
library(mapproj)
}
data(earthquakes)
library(Directional)
hdr08<-as.data.frame(euclid.inv(sphere.plugin.hdr(euclid(earthquakes),tau=0.8,
plot.hdr=FALSE)$hdr))
world <- map_data("world")
g.earthquakes <- ggplot() +
geom_map(data = world, map = world,
mapping = aes(map_id = region),
color = "grey90", fill = "grey80") +
geom_point(data = earthquakes,
mapping = aes(x = Longitude, y = Latitude),
color = "red",alpha=.2,size=.75,stroke=0) +
geom_point(data = hdr08,
mapping = aes(x = Long, y = Lat),
color = "darkblue", size = 1) +
scale_y_continuous(breaks = NULL, limits = c(-90, 90)) +
scale_x_continuous(breaks = NULL, limits = c(-180, 180)) +
coord_map("mercator")
g.earthquakes
# }
Run the code above in your browser using DataLab