tmap
tmap copied to clipboard
interactive synchronic maps in tmap not working in flexdasboard
Hi I've created a map to compare 3 variables in an interactive mode using tmap. When I visualize the output using Rmarkdown in html I'm able to see the synchronicity. As it is shown in the attached picture
Here you have the code for this combination map
`map_SIR <- tm_shape (barris_SIR) +
tm_polygons (c("SIR", "Y", "E"),
style=c("cont", "cont"),
palette=list("-RdBu", "Blues", "Greens"),
auto.palette.mapping=FALSE,
title=c("SIR", "Observats", "Esperats"))
tmap_leaflet(map_SIR) `
But when I use the output flexdasboard in rmarkdown it doesn't print anything.
On the contrary flexdasboard is able to print "single maps" representing one variable for each map. But then I loose the synchronicity as it is shown in pict 2
Can you help me in this issue?
I never used flexdasboard, so probably cannot help.
Please test leafsync
, the package that tmap uses under the hood.
Something like this should work in your case:
library(mapview)
library(leafsync)
m1 = mapview(barris_SIR , col = "SIR")
m2 = mapview(barris_SIR , col = "Y")
m3 = mapview(barris_SIR , col = "E")
sync(m1, m2, m3)
But I cannot reproduce it myself.
In case this also doesn't work please contact @tim-salabim
Hi!! Thanks for your response I've tried your code and it works in the R file, but not in the dashboard as it happened with the tmaps. (Just one little correction with your example code: the parameter "col" is not correct, the good one is "zcol"
Anyway thank you for your help @mtennekes. I will contact @tim-salabim and ask for help