plot_flights {flightplot}R Documentation

The main function to plot flight paths

Description

The plot_flights function use 'ggplot2' to plot flight paths on a world map. The flight path follow the great circle of the Earth, which is computed by 'geosphere'. The function also provides extended functionalities including coloring and cropping.
Since 'ggplot2' is used, additional plotting parameters can be easily added to the result.

Usage

plot_flights(
  trips,
  crop = TRUE,
  land_color = "#f6e8c3",
  water_color = "aliceblue",
  dom_color = "#3288bd",
  int_color = "#d53e4f",
  alpha = 0.5,
  times_as_thickness = TRUE
)

Arguments

trips

A two-column dataframe - The start and end airports of flights. The first column should be the start airports, and the second column the end airports. The airport value should be IATA airport code. The column names can be any valid names.

crop

A logical value or a string - Whether the map should be cropped or not and by which preset the map is cropped. If FALSE, the whole world map is plotted; if TRUE, the map will be cropped based on the airport coordinates. It also accepts certain strings as presets:
"NA": North America.
"48States": The contiguous United States.
The default value is TRUE.

land_color

A string - the color used for land. Default value is "#f6e8c3".

water_color

A string - the color used for earth. Default value is "aliceblue".

dom_color

A string - the color used for domestic flights. Default value is "#3288bd".

int_color

A string - the color used for international flights. Default value is "#d53e4f".

alpha

A double number - 0 to 1. The transparency (alpha) of flight paths. Default value is 0.5.

times_as_thickness

A logical value - whether the times of flights are used as aestheic mappings for the thickness of flight paths. Default value is TRUE.

Value

A plot

Examples

plot_flights(sample_trips[1:20,])


[Package flightplot version 0.1.0 Index]