flightplot
R Package to Plot the Paths of Flights on the World Map
Installation
Please use the following code to install and load the package:
if (!require("devtools")) {
install.packages("devtools")
}
install_github("xmc811/flightplot", ref = "development")
library(flightplot)
Examples
The main plot function plot_flights
accepts a two-column dataframe as input, with one column as departure airports and the other as arrival. The values of airports should be IATA 3-letter codes. sample_trips
is an example dataframe that can be readily used for plotting. The columns names can be any valid names.
sample_trips
Departure | Arrival |
---|---|
LAX | IAH |
IAH | LAX |
SFO | IAH |
IAH | ORL |
ORL | IAH |
IAH | DEN |
DEN | IAH |
... | ... |
To call the main plot function:
plot_flights(sample_trips)
The map can be set to be cropped to presets:
plot_flights(sample_trips, crop = "48States")
Some additional parameters can be adjusted:
plot_flights(sample_trips,
crop = "48States",
land_color = "#fdae6b",
water_color = "#9ecae1",
dom_color = "white",
int_color = "black",
alpha = 1,
times_as_thickness = FALSE)