png/svg symbols for tm_symbols and symbol rotation?
Is it possible to use custom svg/png icons as shape in tm_symbols()? And is it possible to rotate the symbols based on data variable?
Hi @oiramkawon I can partially answer the first question - yes, it is possible - see the last example at https://r-tmap.github.io/tmap-book/visual-variables.html#shapes.
Thanks a lot, good to know. But how are the icons assosciated to the points? When a point has an attribute "airport" how to choose the airport sign?
The order of your icons should be the same as the order of the values of the provided variable (usually alphabetic one).
Thanks for your question. We hadn't thought about rotation for symbols as an aesthetic yet, but it sure is! In tmap3 it is not possible yet (unfortunately), but I plan to add it in tmap4.
In the second last example of tm_symbols there is one that uses a custom airplane.png icon.
If you want to use multiple icon (on for each category), you'll have to specify this with tmap_icons. In addition to @Nowosad 's last answer, the number of icons should correspond to the number of categories. It is good practice to use a factor data variable.
Important thing: you'll have to specify the icons with the argument shapes (which behaves the same as a color palette for col/fill aesthetics), and the data variable name with shape.