Skip to content
This repository was archived by the owner on Jul 15, 2025. It is now read-only.
This repository was archived by the owner on Jul 15, 2025. It is now read-only.

Two questions related to shapes #15

@Nowosad

Description

@Nowosad

@mtennekes two open questions:

  1. Shapes for symbols: they work for both categorical and sequential data. However, should they work for sequential data?
  2. 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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions