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:
install.packages("flightplot")
library(flightplot)If you would like to install the most up-to-date version on GitHub:
if (!require("devtools")) {
install.packages("devtools")
}
install_github("xmc811/flightplot")
library(flightplot)Please use GitHub Issues to report bugs or leave any comments and suggestions. Contributions through pull requests are also welcomed!
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)

