positions <- as.matrix(french_cities[1:10, c("th_longitude", "th_latitude")])
distances <- french_cities_distances[1:10, 1:10] / 1000 ## convert to km
production <- rep(1, 10)
attractiveness <- log(french_cities$area[1:10])
flows <- blvim(distances, production, 1.5, 1 / 150, attractiveness,
origin_data = list(
names = french_cities$name[1:10],
positions = positions
),
destination_data = list(
names = french_cities$name[1:10],
positions = positions
),
bipartite = FALSE
)
ggplot2::autoplot(flows)
## bar plots should be almost identical if convergence occurred
sim_converged(flows)
ggplot2::autoplot(flows, "destination")
ggplot2::autoplot(flows, "attractiveness")
## names inclusion
ggplot2::autoplot(flows, "destination", with_names = TRUE) +
ggplot2::coord_flip()
ggplot2::autoplot(flows, with_names = TRUE) +
ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 90))
## positions
ggplot2::autoplot(flows, "attractiveness", with_positions = TRUE) +
ggplot2::scale_size_continuous(range = c(0, 6)) +
ggplot2::coord_sf(crs = "epsg:4326")
ggplot2::autoplot(flows, "destination",
with_positions = TRUE,
with_names = TRUE
) +
ggplot2::scale_size_continuous(range = c(0, 6)) +
ggplot2::coord_sf(crs = "epsg:4326")
ggplot2::autoplot(flows, "destination",
with_positions = TRUE,
with_names = TRUE, with_labels = TRUE
) +
ggplot2::scale_size_continuous(range = c(0, 6)) +
ggplot2::coord_sf(crs = "epsg:4326")
ggplot2::autoplot(flows, with_positions = TRUE) +
ggplot2::scale_linewidth_continuous(range = c(0, 2)) +
ggplot2::coord_sf(crs = "epsg:4326")
ggplot2::autoplot(flows,
with_positions = TRUE,
arrow = ggplot2::arrow(length = ggplot2::unit(0.025, "npc"))
) +
ggplot2::scale_linewidth_continuous(range = c(0, 2)) +
ggplot2::coord_sf(crs = "epsg:4326")
## individual flows combined with destination flows
## no arrows
ggplot2::autoplot(flows,
with_positions = TRUE,
show_destination = TRUE
) +
ggplot2::scale_linewidth_continuous(range = c(0, 2)) +
ggplot2::coord_sf(crs = "epsg:4326")
## readding arrows
ggplot2::autoplot(flows,
with_positions = TRUE,
show_destination = TRUE,
arrow = ggplot2::arrow(length = ggplot2::unit(0.025, "npc"))
) +
ggplot2::scale_linewidth_continuous(range = c(0, 2)) +
ggplot2::coord_sf(crs = "epsg:4326")
Run the code above in your browser using DataLab