
Plot data interactively
Source:vignettes/visualization_tutorials/plot_data_interactively.Rmd
plot_data_interactively.RmdThis article shows different ways on how to plot WATLAS data
interactively using plotly and mapview. This
is useful when manually checking specific data. plotly
allows for a quick interactive overview of the data from any
ggplot2 and mapview is specifically designed
for spatial data and provides more options for exploration
(e.g. specification of what should be shown and different base maps).
Check the specific tutorials for more details the plotly or mapview.
Interactive plot using plotly
Note that the scale bar is not supported at the moment and
plotly will give a warning if the base map contains a scale
bar.
# load example data
data <- data_example
# create basemap
bm <- atl_create_bm(data, buffer = 800, scalebar = FALSE)
# plot points and tracks with standard ggplot colours
p <- bm +
geom_path(
data = data, aes(x, y, colour = tag),
linewidth = 0.5, alpha = 0.1, show.legend = TRUE
) +
geom_point(
data = data, aes(x, y, colour = tag),
size = 0.5, alpha = 1, show.legend = TRUE
) +
scale_color_discrete(name = paste("N = ", length(unique(data$tag)))) +
theme(legend.position = "top")
# plot interactively
ggplotly(p, tooltip = c("tag", "x", "y"))