r - 使用 ggplot2 绘制地图
问题描述
我正在尝试使用此代码在瑞士地图上绘制数据
require("rgdal")
require("maptools")
require("ggplot2")
require("plyr")
require("maps")
require("ggmap")
ggplot() + geom_polygon(data = da, aes(x=long, y = lat)) +
coord_fixed(1.3)+
geom_point(data=de, aes(x=lat, y=lon), color="orange")
其中 data da 是使用 swissmap 包的地图:
da<- shp_df[[6]]
& 数据是:
'data.frame': 115 obs. of 5 variables:
$ FB : Factor w/ 3 levels "I","II","IV": 2 2 2 3 1 2 1 3 1 1
$ Nom : Factor w/ 115 levels "\"Patient Education\" Programm unipolare Depression",..: 9 31 95 112 92 41 70 84 13 21 ...
$ lon : num 7.36 8.54 7.08 NA 7.45 ...
$ lat : num 46.2 47.4 46.1 NA 46.9 ...
$ Coûts: int 100000 380000 150000 300000 2544000 300000 1897000 500000 2930000 2400000 ...
我得到了这个结果。 这不是我想要的,我试图在位置(有时是同一个地方)绘制数据集中的数据。任何帮助或建议将不胜感激。谢谢你
解决方案
推荐阅读
- .net - 如何在云中托管完整的 Vue 应用程序、.NET Core API 和 MariaDB 堆栈?
- javascript - 使用按钮将页面路由到另一个页面(React)
- amazon-cloudwatch - 设置 AWS CloudWatch 警报以在处于 INSUFFICIENT_DATA 状态时通过 SNS 发出警报
- javascript - 如果数组更改但某些键保持不变,React 是否会重新渲染 FOR 循环的所有组件?
- regex - 正则表达式步骤
- c# - 在 C# 中创建反序列化类型数组的方法
- docker - 在 docker 中运行的下一次没有看到主机上的文件已更改
- php - 将不需要的 html 写入文本文件
- python - 我不明白,我一直期待一个缩进的块
- python - 在 Heroku 上存储单行更改文本的方法