Plot a layer of graduated links. Links are plotted according to discrete classes of widths.
gradLinkLayer(spdf, df, spdfid = NULL, spdfids, spdfide, dfid = NULL, dfids,
dfide, var, breaks = getBreaks(v = df[, var], nclass = 4, method =
"quantile"), lwd = c(1, 2, 4, 6), col = "red",
legend.pos = "bottomleft", legend.title.txt = var,
legend.title.cex = 0.8, legend.values.cex = 0.6, legend.values.rnd = 0,
legend.frame = FALSE, add = TRUE)
Arguments
- spdf
- SpatialLinesDataFrame; a link layer.
- df
- data frame with identifier(s) and a variable.
- spdfid
- unique identifier in spdf (spdfids, spdfide, dfids and dfide are not used).
- spdfids
- identifier of starting points in spdf (spdfid and dfid are not used).
- spdfide
- identifier of ending points in spdf (spdfid and dfid are not used).
- dfid
- unique identifier in df (spdfids, spdfide, dfids and dfide are not used).
- dfids
- identifier of starting points in df (spdfid and dfid are not used).
- dfide
- identifier of ending points in df (spdfid and dfid are not used).
- var
- name of the variable used to plot the links widths.
- breaks
- break values in sorted order to indicate the intervals for assigning the lines widths.
- lwd
- vector of widths (classes of widths).
- col
- color of the links.
- legend.pos
- position of the legend, one of "topleft", "top",
"topright", "left", "right", "bottomleft", "bottom", "bottomright". If
legend.pos is "n" then the legend is not plotted.
- legend.title.txt
- title of the legend.
- legend.title.cex
- size of the legend title.
- legend.values.cex
- size of the values in the legend.
- legend.values.rnd
- number of decimal places of the values
displayed in the legend.
- legend.frame
- whether to add a frame to the legend (TRUE) or
not (FALSE).
- add
- whether to add the layer to an existing plot (TRUE) or
not (FALSE).
Note
Unlike most of cartography functions, identifiers fields are mandatory.
See also
getLinkLayer, propLinkLayer, legendGradLines
Examples
gradLinkLayer(spdf = twincities.spdf, df = twincities.df,
spdfids = "i", spdfide = "j",
dfids = "i", dfide = "j",legend.pos = "topright",
var = "fij", breaks = c(2,5,15,20,30), lwd = c(0.1,1,4,10),
col = "#92000090", add = TRUE)
