我正在使用 choroplethr 为美国西半部(州和县)创建气候地图。地图已完成,看起来很棒。现在我需要在地图上绘制出现点(经度/纬度)。我尝试了许多功能(lat/lon 和 lon/lat,两者)。不幸的是,到目前为止我还没有找到解决方案。怎么可能做到这一点?
PS(2018 年 3 月 18 日):我已经尝试(例如)以下语句来绘制发生点,它似乎被接受,没有错误,但也没有反应:NAM_prt = NAM_prt + geom_point(data=spec_US_df, aes( x = lon, y = lat), color="red", size=30, alpha=0.5)
library(choroplethr)
# Preparing the input data.frame containing "region" and "value"
state = c('ARI')
county = c('Apache', 'Cochise', 'Coconino', 'Gila', 'Graham', 'Greenlee', 'La Paz', 'Maricopa', 'Mohave', 'Navajo', 'Pima', 'Pinal', 'Santa Cruz', 'Yavapai', 'Yuma')
region = c(4001, 4003, 4005, 4007, 4009, 4011, 4012, 4013, 4015, 4017, 4019, 4021, 4023, 4025, 4027)
value = c(40, 88, 19, 10, 10, 0, 0, 302, 47, 0,222, 9, 0, 34, 40)
SWNAMcounties = data.frame(state = state, county = county, region = region, value = value)
# Preparing the choropleth map
NAM_prt = county_choropleth(SWNAMcounties,
title = "County Climate Map (Data from 1990 to 1995)",
legend = "Impact",
num_colors = 1,
state_zoom = c("arizona"))
NAM_prt
# part 2:
# Creating occurrence points (lat/lon)
lat = c('32.22528', '32.36194', '32.66156', '32.38121', '32.69486', '32.36842', '32.51652')
lon = c('-111.1206', '-109.6742', '-110.1742', '-109.6278', '-109.4554', '-109.5601', '-110.0397')
spec_US_df = data.frame(lat, lon)
强文本