微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决通过 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 在此解决方案中非常小。

保持健康!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?