#' Visualization of a triangulation track
#' @description Maps triangulation points and plots the track based on the timestamp
#'
#' @param triang data.frame of telemetry data
#'
#' @return ggplot object
#'
#' @author Marvin Ludwig
#'
#' @import ggplot2
#' @import viridis
#' @import lubridate
#'
#' @export
visTrack <- function(triang){
# id for coloring
triang$id <- seq(nrow(triang))
# labels
l1 <- paste0(lubridate::hour(triang$timestamp[1]), ":" ,lubridate::minute(triang$timestamp[1]))
l2 <- paste0(lubridate::hour(triang$timestamp[nrow(triang)]), ":" ,lubridate::minute(triang$timestamp[nrow(triang)]))
return(
ggplot(triang, aes(pos.utm.X, pos.utm.Y, color = id))+
geom_point(size = 1.5)+
scale_colour_gradientn(name = "Time", colors = viridis(100), breaks = c(1,nrow(triang)), labels = c(l1, l2))+
geom_path()+
scale_x_continuous(name = NULL, expand = c(0.1,0.1))+
scale_y_continuous(name = NULL, expand = c(0.1,0.1))+
coord_equal()+
theme(axis.text.y = element_text(angle = 90, hjust = 0.5), legend.position = "bottom",
panel.background = element_blank(), panel.grid = element_line(color = "grey80"))
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.