This is the main function of the package.
mf_map()
can be used to plot all types of maps.
The three main arguments are: x
(sf object), var
(variable to map), and
type
(map type).
Relevant arguments and default values for each map types are detailed in
specific functions, see Details.
mf_map(
x,
var,
type = "base",
breaks,
nbreaks,
pal,
alpha,
inches,
val_max,
symbol,
col,
lwd_max,
val_order,
pch,
cex,
border,
lwd,
col_na,
cex_na,
pch_na,
leg_pos,
leg_title,
leg_title_cex,
leg_val_cex,
leg_val_rnd,
leg_no_data,
leg_frame,
expandBB,
add
)
object of class sf
or sfc
name(s) of the variable(s) to plot
map type:
base, base maps,
prop, proportional symbols maps,
choro, choropleth maps,
typo, typology maps,
symb, symbols maps,
grad, graduated symbols maps,
prop_choro, proportional symbols maps with symbols colors based on a quantitative data classification,
prop_typo, proportional symbols maps with symbols colors based on qualitative data,
symb_choro, symbols maps with symbols colors based on a quantitative data classification
either a numeric vector with the actual breaks, or a classification method name (see mf_get_breaks and Details)
number of classes
a set of colors or a palette name (from hcl.colors)
if pal
is a hcl.colors palette name, the alpha-transparency level in the range [0,1]
size of the biggest symbol (radius for circles, half width for squares) in inches.
maximum value used for proportional symbols
type of symbols, 'circle' or 'square'
color
line width of the largest line
values order, a character vector that matches var modalities
pch (point type) for symbols
cex (point size) for symbols
border color
border width
color for missing values
cex (point size) for NA values
pch (point type) for NA values
position of the legend, one of 'topleft', 'top','topright', 'right', 'bottomright', 'bottom', 'bottomleft', 'left' or a vector of two coordinates in map units (c(x, y)). If leg_pos = NA then the legend is not plotted. If leg_pos = 'interactive' click onthe map to choose the legend position.
legend title
size of the legend title
size of the values in the legend
number of decimal places of the values in the legend
label for missing values
whether to add a frame to the legend (TRUE) or not (FALSE)
fractional values to expand the bounding box with, in each direction (bottom, left, top, right)
whether to add the layer to an existing plot (TRUE) or not (FALSE)
x is (invisibly) returned.
Relevant arguments and default values for each map types are detailed in specific functions:
base, base maps (mf_base);
prop, proportional symbols maps (mf_prop);
choro, choropleth maps (mf_choro);
typo, typology maps (mf_typo);
symb, symbols maps (mf_symb);
grad, graduated symbols maps (mf_grad);
prop_choro, proportional symbols maps with symbols colors based on a quantitative data classification (mf_prop_choro);
prop_typo, proportional symbols maps with symbols colors based on qualitative data (mf_prop_typo);
symb_choro, symbols maps with symbols colors based on a quantitative data classification (mf_symb_choro).
Breaks defined by a numeric vector or a classification method are
left-closed: breaks defined by c(2, 5, 10, 15, 20)
will be mapped as:
[2 - 5[
[5 - 10[
[10 - 15[
[15 - 20]
The "jenks" method is an exception and has to be right-closed.
Jenks breaks computed as c(2, 5, 10, 15, 20)
will be mapped as:
[2 - 5]
]5 - 10]
]10 - 15]
]15 - 20]
mtq <- mf_get_mtq()
mf_map(mtq)
mf_map(mtq, var = "POP", type = "prop")
mf_map(mtq, var = "MED", type = "choro")
mf_map(mtq, var = "STATUS", type = "typo")
mf_map(mtq)
mf_map(mtq, var = "STATUS", type = "symb")
mf_map(mtq)
mf_map(mtq, var = "POP", type = "grad")
mf_map(mtq)
mf_map(mtq, var = c("POP", "MED"), type = "prop_choro")
mf_map(mtq)
mf_map(mtq, var = c("POP", "STATUS"), type = "prop_typo")
mf_map(mtq)
mf_map(mtq, var = c("STATUS", "MED"), type = "symb_choro")