tmap-book
tmap-book copied to clipboard
Two questions related to shapes
@mtennekes two open questions:
- Shapes for symbols: they work for both categorical and sequential data. However, should they work for sequential data?
- Shapes (lty) for lines: right now it is only possible to set one line type for all of the data. Would it be possible to allow to provide a categorical variable here?
library(tmap)
data("rivers", package = "tmap")
data("metro", package = "tmap")
set.seed(222)
metro2 = metro[sample(1:nrow(metro), 30), ]
set.seed(231)
metro2$group = as.character(sample(1:3, size = nrow(metro2), replace = TRUE))
# 1 -----------------------------------------------------------------------
# works
tm_shape(metro2) +
tm_symbols(shape = "group")
#> Linking to GEOS 3.8.1, GDAL 3.0.4, PROJ 6.3.2
# also works - but should it?
tm_shape(metro2) +
tm_symbols(shape = "pop1950")
#> Warning: Not enough symbol shapes available. Shapes will be re-used.
# 2 -----------------------------------------------------------------------
# works
tm_shape(rivers) +
tm_lines(lty = 2)
# does not work
tm_shape(rivers) +
tm_lines(lty = "type")
#> Error in grid.Call.graphics(C_lines, x$x, x$y, index, x$arrow): invalid hex digit in 'color' or 'lty'
Created on 2020-11-10 by the reprex package (v0.3.0)
This is something to look at for v4