r - SF 对象的大小图例不会显示正确的符号

标签 r ggplot2 gis geospatial sf

有谁知道为什么要传说size静电 BIR74不会显示点大小而是矩形?如果答案是肯定的,我该如何解决这个问题?

可重现的例子:

library(sf)
# devtools::install_github("tidyverse/ggplot2")
library(ggplot2)

nc <- st_read(system.file("shape/nc.shp", package="sf"))

nc_centers <- st_centroid(nc)

nc_centers %>%
  ggplot() +
  geom_sf(aes(color = SID79, size = BIR74)) +
  coord_sf(datum = NA) +
  theme_minimal()

enter image description here

最佳答案

您需要将 show.legend 参数添加到 geom_sf,即

nc_centers %>%
  ggplot() +
  geom_sf(aes(color = SID79, size = BIR74), show.legend = 'point') +
  coord_sf(datum = NA) +
  theme_minimal()

enter image description here

关于r - SF 对象的大小图例不会显示正确的符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49555694/

相关文章:

java - 使用 ESRI android API 打开文件地理数据库

r - 一次性将分隔符(但仅限唯一值)拆分为新行?

r - R 中 "Could not resolve host"的修复是什么

r - 在 ggplot 比例函数中引用数据集变量的正确方法是什么?

algorithm - 如何将UTM坐标转换为纬度和经度?

android - 在 android studio 中安装 Mapbox 的问题

r - 泊松回归的预测

r - 使用受约束的 B 样条近似形状轮廓

r - 包装几个 ggplot2 函数并在 R 中使用带有运算符 "+"的包装器

R ggplot2 - 在一个方面对每对执行成对测试并使用 ggsignif 显示 p 值