positions <- matrix(rnorm(10 * 2), ncol = 2)
colnames(positions) <- c("X", "Y")
distances <- as.matrix(dist(positions))
production <- rep(1, 10)
attractiveness <- c(2, rep(1, 9))
flows <- blvim(distances, production, 1.5, 4, attractiveness,
origin_data =
list(names = LETTERS[1:10], positions = positions),
destination_data =
list(names = LETTERS[1:10], positions = positions)
)
ggplot2::fortify(flows)
ggplot2::fortify(flows, flows = "destination")
ggplot2::fortify(flows, flows = "attractiveness")
## positions
ggplot2::fortify(flows, flows = "attractiveness", with_positions = TRUE)
## names and positions
ggplot2::fortify(flows,
flows = "destination", with_positions = TRUE,
with_names = TRUE
)
ggplot2::fortify(flows, with_positions = TRUE, cut_off = 0.1)
Run the code above in your browser using DataLab