通过 cex 的 Mapview pointsize 不是固定大小的映射子集或更新的数据

问题描述

新年好!

实际上我想在地图上显示 CoVid19 病例。我有每个案例的地址。 我为每个案例在地图上绘制了一个点。这很好用!

有些地址有不止一个案例(例如一个家庭)。因此,我想通过 cex 选项控制点的大小。对于每张地图,这同样适用。

但是一张地图中的 cex = 1 并不自动意味着下一张地图(例如第二天)中 cex = 1 的点具有相同的大小。

我如何控制它,每个地图(天)的 cex=1 大小相同?

简单示例:

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")

感谢您的帮助!

保持健康!

解决方法

我直接从 R-mapview 包的开发者那里得到了这个答案:

“当前 fgb 渲染模式和经典渲染模式之间存在差异,前者不考虑参数 min.rad 和 max.rad。作为一种解决方法,您可以设置 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)

为了获得更大的灵活性,我建议通过代码设置 min.radmax.rad

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,min.rad = cexmin,max.rad = cexmax)

我分别在 + 1cexmax 中添加了一个 cexmincex = 1,因为 # Groups to look for $groups = 'Group1','Group2','Group3' # Import users to check from a csv file Import-Csv "$PSScriptroot\Users.csv" | ForEach-Object { # Get all groups that the $user is a member of $membership = (Get-ADPrincipalGroupMembership $_.samAccountName).Name $_ | Select-Object *,@{Name = 'Group1'; Expression = { 'Group1' -in $membership }},@{Name = 'Group2'; Expression = { 'Group2' -in $membership }},@{Name = 'Group3'; Expression = { 'Group3' -in $membership }} } | Export-Csv -Path "$PSScriptroot\Users_New.csv" -NoTypeInformation 在此解决方案中非常小。

保持健康!

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...