r-tmap/tmap-book

Question: tm_text

Closed this issue · 2 comments

@mtennekes could you tell me (or point me to the code) how tm_text() relates to other layer types. I assume it just uses coordinates of points, and centroids (??) of lines and polygons?

Yes, exactly. tm_text uses spatial points, just like tm_symbols. For (multi)polygons/lines, the centroids are used, but there are a few options: see tm_shape's options point.per and line.center.

In v4, I plan to separate this 'geometry transformation' part into single functions that can be specified in the layer functions. E.g.

tm_text("name", 
    size = "population", 
    size.setup = tm_aes_cont(legend.sizes = c(10, 20, 30)*1e6), 
    geom = tm_geom_centroid(per.feature = TRUE)) 

I plan to start writing the chapter 'tmap extensions' while working on v4. Then we can iteratively exchange ideas.

The 'tmap extensions' chapter sounds great!