0

Good New Year!

Actually I want to show on a map CoVid19 cases. I have the adresses of each case. I plot for each case a piont on the map. This works fine!

Some adresses have more than one case (e.g. one familiy). Therefor I want to control the size of the points via the cex-option. This again workes fine for each single map.

But a cex = 1 in one map does not automatically mean that points with cex = 1 in the next map (eg. the next day) have the same size.

How can I control it, that cex=1 is the same size for each map (day)?

Simple examples:

breweries1 <- breweries %>% filter(number.of.types == 1)
mapview(breweries1, cex = "number.of.types")
breweries2 <- breweries %>% filter(number.of.types < 3)
mapview(breweries2, cex = "number.of.types")

Thank you for any help!

Stay healthy!

1 Answers1

0

Drectly from the developer of the R-mapview package I got this answer:

"There is currently a discrepancy between fgb rendering mode and classic rendering mode where the former does not respect arguments min.rad & max.rad. As a workaround you can set mapviewOptions(fgb = FALSE):"

library(mapview)
library(dplyr)

mapviewOptions(fgb = FALSE)

breweries1 <- breweries %>% filter(number.of.types == 1)
mapview(breweries1, cex = 10) # supply cex directly as only one size
breweries2 <- breweries %>% filter(number.of.types < 3)
mapview(breweries2, cex = "number.of.types", min.rad = 10, max.rad = 20)

For more flexibility I recomend to set min.rad and max.rad by code:

mapviewOptions(fgb = FALSE)
breweries2 <- breweries %>% filter(number.of.types < 3)
cexmin = min(breweries2$number.of.types) + 1
cexmax = max(breweries2$number.of.type) + 1
mapview(breweries2, cex = "number.of.types", min.rad = cexmin, max.rad = cexmax)

I added a + 1 to cexmax resp. cexmin, because cex = 1 is very small in this solution.

Stay healthy!