r-tmap/tmap-book

Adding new arguments to tm_rgb()

Closed this issue · 2 comments

I wrote an example of using tm_rgb() in Chapter 5. However, it would be much better if users could also stretch the colors... There have been some recent improvements in the stars package that could be useful here. See - r-spatial/stars#315 (comment) and https://rdrr.io/cran/stars/man/st_rgb.html. The st_rgb() function already has two important arguments - stretch and probs.

@mtennekes would it be possible to add these arguments to tmap? It would allow me to complete Section 5.5 of the book...

The need for these new arguments has already been stated in the following issues: https://github.com/mtennekes/tmap/issues/294 and https://github.com/mtennekes/tmap/issues/345

Yes definitely, but in v4. Within this new framework, these features will not be limited to raster data, but will be part of a function that maps RGB values (of any layer) to a color values. This function is called tm_aes_color_rgb.

I'm currently working on the whole framework, not (yet) on the implementations of the functions. For the implementation it would be good to share ideas with you and other users. When I have the framework sort-of fixed, I'll post a few GH issues to exchange ideas.

Thanks for the explanation Martijn!