I have a large dataset with 60+ elements (geochemistry), for which I am using tmap to produce spatial geochemical maps.
Some elements require subscripts to be printed in the following spots:
[x] Main title, using tm_layout()
[x] Legend title, using tm_raster()
[x] Custom metadata box, using tm_credits()
I am currently unable to use unicode for adding subscripts with the current machine, and have used expressions elsewhere in tm_layout() and tm_raster() to achieve the desired style. The current problem is with tm_credits().
The minimal working example below produces the expected style:
data("World")
tmap.compass.LHS.var <- tm_compass(north = 0, type = "4star", show.labels = 2, position = c("left","top"), size = 3, just = c("right", "top"))
tmap.scalebar.LHS <- tm_scale_bar(width = 0.25, position = c("left","top"), bg.color="white", bg.alpha = 0) +
tm_credits("UNIVERSAL TRANSVERSE MERCATOR PROJECTION\nGeocentric Datum of Australia 1994\n ", position = c("left","top"), align = "left", just = "center",size = 0.5, bg.color="white", bg.alpha = 0)
tmap.maincredits <- tm_credits("Project Title" , position = c("center","bottom"), align = "center", just = "center", size = 2, col = "black", fontface = "bold.italic", bg.color="white", bg.alpha = 0) +
tm_credits("Project Sub-title\nProject Institutions" , position = c("center","bottom"), align = "center", just = "center", size = 2, col = "black", fontface = "bold.italic", bg.color="white", bg.alpha = 0)
# This plots with correct styling
tm_shape(World) +
tm_polygons("HPI") +
tmap.scalebar.LHS +
tmap.compass.LHS.var +
tmap.maincredits
However, when I use a combination of bquote, list, and do.call, the correct subscripts are added, however the text formatting elsewhere in the tmap is removed.
So far this is the closest I've come to correctly formatting the subscripts with pasted text (e.g. "LiBO"[2]),
and text from variables ( .(sub_title1) ). However, it strips/removes the existing formatting and styles throughout the map.
Again, due to the large dataset with varying subscript positions and machines, unicode is not possible.
It would be of benefit to allow expressions, or suggest a work-around.
Many thanks in advance, and your package is greatly appreciated!
Thanks!
Greetings!
I have a large dataset with 60+ elements (geochemistry), for which I am using tmap to produce spatial geochemical maps. Some elements require subscripts to be printed in the following spots:
I am currently unable to use unicode for adding subscripts with the current machine, and have used expressions elsewhere in tm_layout() and tm_raster() to achieve the desired style. The current problem is with tm_credits().
The minimal working example below produces the expected style:
However, when I use a combination of bquote, list, and do.call, the correct subscripts are added, however the text formatting elsewhere in the tmap is removed.
So far this is the closest I've come to correctly formatting the subscripts with pasted text (e.g. "LiBO"[2]), and text from variables ( .(sub_title1) ). However, it strips/removes the existing formatting and styles throughout the map. Again, due to the large dataset with varying subscript positions and machines, unicode is not possible.
It would be of benefit to allow expressions, or suggest a work-around.
Many thanks in advance, and your package is greatly appreciated! Thanks!