Plot a trajectory object in 2D or 3D.

# S3 method for trajectory
plot(
  x,
  threeD = FALSE,
  col = "#2980b9",
  col_start = "#e67e22",
  col_end = "#e67e22",
  pch_points_start = 15,
  pch_points_end = 16,
  cex_points = 1.5,
  add_altitude = TRUE,
  n_split = 6,
  plot_end_points = TRUE,
  add_title = TRUE,
  threeD_line_width = 4,
  threeD_line_color = "#008080",
  threeD_col_grad = FALSE,
  threeD_grad_start = "#008080",
  threeD_grad_end = "#ab53cf",
  ...
)

Arguments

x

A trajectory object

threeD

A boolean indicating whether the plot should be 3D or 2D (default FALSE, 2D).

col

A string corresponding to the color of the line used for 2D trajectory (default "blue4").

col_start

A string corresponding to the color of the point used to denote the beginning of a 2D trajectory (default "green3").

col_end

A string corresponding to the color of the point used to denote the end of a 2D trajectory (default "red2").

pch_points_start

A numeric corresponding to the symbol (pch) of the points used to denote the beginning of a 2D trajectory (default 15).

pch_points_end

A numeric corresponding to the symbol (pch) of the points used to denote the end of a 2D trajectory (default 16).

cex_points

A numeric corresponding to the size (cex) of the points used to denote the beginning and the end of a 2D trajectory (default 1.5).

add_altitude

A boolean to indicate if the altitude should be plotted in 2D trajectory in NED system (default TRUE; altitude is plotted).

n_split

A numeric for the number of ticks in 2D plot with altitude profile, if NULL no ticks are added (default = 6).

plot_end_points

A boolean to indicate if points should be plotted at the beginning and the end of a 2D trajectory (default TRUE; points are plotted).

add_title

A boolean or string. If a boolean is used it indicates if a title should be added to 2D trajectory (only active if name of trajectory exist); if a string is used it corresponds to the title (default TRUE).

threeD_line_width

A numeric corresponding to the width of the line for a 3D trajectory (default 4).

threeD_line_color

A string corresponding to the hex color code of the line used for a 3D trajectory (default "#008080").

threeD_col_grad

A boolean to indicate if a color gradient should be used for a 3D trajectory (default FALSE).

threeD_grad_start

A string corresponding to the hex color code for the start of the gradient (default "#008080").

threeD_grad_end

A string corresponding to the hex color code for the end of the gradient (default "#ab53cf").

...

Additional arguments affecting the plot produced.

Value

A trajectory plot.

Author

Davide Cucci, Lionel Voirol, Mehran Khaghani, Stéphane Guerrier

Examples

n <- 100
set.seed(123)
dat <- cbind(
  seq(from = 0, to = 60 * 60, length.out = n),
  46.204391 * pi / 180 + cumsum(rnorm(n)) / 10^5,
  6.143158 * pi / 180 + cumsum(rnorm(n)) / 10^5,
  375 + cumsum(rnorm(n))
)
traj <- make_trajectory(data = dat, name = "My cool data")
plot(traj)
plot(traj, threeD = TRUE)
plot(traj, threeD = TRUE, threeD_line_width = 8, threeD_line_color = "#e74c3c" )
plot(traj, threeD = TRUE, threeD_col_grad = TRUE )
plot(traj, threeD = TRUE, threeD_col_grad = TRUE, threeD_grad_start = "#e74c3c", threeD_grad_end = "#d68910" )
traj <- make_trajectory(data = dat, name = "My cool data", system = "ned") plot(traj) plot(traj, col = "orange2", col_start = "pink", col_end = "purple") plot(traj, pch_points_start = 15, cex_points = 3) plot(traj, plot_end_points = FALSE) plot(traj, plot_end_points = FALSE, add_title = FALSE)