FOSS4G 2021 - 2021/09/30
mf_map()
mf_map()
is the main function of the package.
mf_map(x = sf_object, var = "variable", type = "map type", ...)
?mf_map()
mtq <- mf_get_mtq() # # # # # # Plot the base map mf_map(x = mtq) # # # # # # # # # # # # # # # #
mtq <- mf_get_mtq() # # # # # # Plot a choropleth map mf_map(x = mtq, var = "MED", type = "choro") # # # # # # # # # # # # # # # #
mtq <- mf_get_mtq() # # # # # # Plot a choropleth map mf_map(x = mtq, var = "MED", type = "choro", pal = "Dark Mint", breaks = "quantile", nbreaks = 6, leg_title = "Median Income\n(euros)", leg_val_rnd = -2, leg_pos = "topright") # # # # # # # # # #
mtq <- mf_get_mtq() # # # # # # Plot a choropleth map mf_map(x = mtq, var = "MED", type = "choro", pal = "Dark Mint", breaks = "quantile", nbreaks = 6, leg_title = "Median Income\n(euros)", leg_val_rnd = -2, leg_pos = "topright") # # # # # # Plot a layout elements mf_title("Wealth in Martinique, 2015") mf_credits("T. Giraud\nSources: INSEE & IGN, 2018") mf_scale(size = 5) mf_arrow('topleft')
mtq <- mf_get_mtq() # Start a map using a theme mf_init(x = mtq, theme = "dark") # # # # Plot a choropleth map mf_map(x = mtq, var = "MED", type = "choro", pal = "Dark Mint", breaks = "quantile", nbreaks = 6, leg_title = "Median Income\n(euros)", leg_val_rnd = -2, leg_pos = "topright", add = TRUE) # # # # # Plot a layout elements mf_title("Wealth in Martinique, 2015") mf_credits("T. Giraud\nSources: INSEE & IGN, 2018") mf_scale(size = 5) mf_arrow('topleft')
mtq <- mf_get_mtq() # Start a map using a theme mf_init(x = mtq, theme = "dark") # # Plot a shadow mf_shadow(mtq, col = "grey10", add = TRUE) # Plot a choropleth map mf_map(x = mtq, var = "MED", type = "choro", pal = "Dark Mint", breaks = "quantile", nbreaks = 6, leg_title = "Median Income\n(euros)", leg_val_rnd = -2, leg_pos = "topright", add = TRUE) # # # # # Plot a layout elements mf_title("Wealth in Martinique, 2015") mf_credits("T. Giraud\nSources: INSEE & IGN, 2018") mf_scale(size = 5) mf_arrow('topleft')
mtq <- mf_get_mtq() # Start a map using a theme mf_init(x = mtq, theme = "dark") # # Plot a shadow mf_shadow(mtq, col = "grey10", add = TRUE) # Plot a choropleth map mf_map(x = mtq, var = "MED", type = "choro", pal = "Dark Mint", breaks = "quantile", nbreaks = 6, leg_title = "Median Income\n(euros)", leg_val_rnd = -2, leg_pos = "topright", add = TRUE) # Add an inset world map mf_inset_on(x = "worldmap", pos = "right") mf_worldmap(mtq, col = "#0E3F5C") mf_inset_off() # Plot a layout elements mf_title("Wealth in Martinique, 2015") mf_credits("T. Giraud\nSources: INSEE & IGN, 2018") mf_scale(size = 5) mf_arrow('topleft')
mtq <- mf_get_mtq() # Start a map using a theme and extra margins mf_init(x = mtq, theme = "dark", expandBB = c(0,0,0,.3)) # Plot a shadow mf_shadow(mtq, col = "grey10", add = TRUE) # Plot a choropleth map mf_map(x = mtq, var = "MED", type = "choro", pal = "Dark Mint", breaks = "quantile", nbreaks = 6, leg_title = "Median Income\n(euros)", leg_val_rnd = -2, leg_pos = "topright", add = TRUE) # Add an inset world map mf_inset_on(x = "worldmap", pos = "right") mf_worldmap(mtq, col = "#0E3F5C") mf_inset_off() # Plot a layout elements mf_title("Wealth in Martinique, 2015") mf_credits("T. Giraud\nSources: INSEE & IGN, 2018") mf_scale(size = 5) mf_arrow('topleft')
mf_map(mtq) mf_inset_on(x = mtq[1, ], cex = .3) mf_map(mtq[1, ]) mf_inset_off()
mf_map(mtq) mf_inset_on(x = "worldmap", pos = "bottomleft") mf_worldmap(x = mtq) mf_inset_off()
library(maptiles) osm <- get_tiles( x = mtq, provider = "Stamen.TerrainBackground", crop= TRUE, zoom = 11 ) mf_theme("default", bg = "#99b3cc") mf_raster(osm) mf_map(mtq, border = "tomato4", col = NA, add = TRUE) mf_scale() mf_title("mf_raster()") mf_credits( txt = get_credit("Stamen.TerrainBackground") )
library(mapsf) mtq <- mf_get_mtq() mf_init(mtq) mf_background("img/blackboard.jpg") mf_map(mtq, lwd = 3, col = NA, border = "white", add = TRUE) mf_credits( txt = "Photo by Noita Digital on Unsplash", col = "white" ) mf_title("mf_background()")
Legends for rasters (continuous, classes, categories)
Horizontal layout for legends
A minimal number of well-known dependencies
CI/CD with GitHub Actions
Tests with tinytest
package, coverage with Codecov
Informative commit messages with conventional commits
riatelab.github.io/mapsf
github.com/rCarto/foss4g2021
github.com/riatelab/mapsf
@rgeomatic
rgeomatic.hypotheses.org