使用 R 生成热图

问题描述 投票:0回答:0

我如何使用 RStudio 生成各州癌症患病率的热图。我一直只得到一个空地块的 US ma

图书馆(地图项目) 图书馆(ggmap)

us_map <- get_map(location = "united states", zoom = 3)

ggmap(us_map) + geom_density2d(data = state_data_clean, aes(x = Longitude, y = Latitude, color = avg_cancer), alpha = 0.4) + scale_color_gradient(low = "yellow", high = "red", name = "Avg Cancer Prevalence")

ggplot(state_data_clean, aes(x = long, y = lat, group = group, fill = avg_cancer)) + geom_tile() + scale_fill_gradient(low = "yellow", high = "red", name = "Avg Cancer Prevalence") + theme_void() + 坐标图()

r heatmap
© www.soinside.com 2019 - 2024. All rights reserved.