[英]Transforming a choropleth map to bubble map in R
I am quite a beginner in R and have made a choropleth world map based on frequencies that different countries were mentioned.我是 R 的初学者,并根据提到的不同国家的频率制作了一个等值线世界 map。 I would like to transform it into a bubble map, where the size of the bubble represents the frequency.
我想把它变成一个气泡 map,其中气泡的大小代表频率。 I think I am just missing one command to take it from the fill to the bubbles but am unsure what to change/add.
我想我只是缺少一个将其从填充到气泡的命令,但不确定要更改/添加什么。
example of choropleth map which I want to transform to bubble map我想转换为气泡 map 的等值线 map 的示例
map1<-ggplot(mapdata, aes( x = long.x, y = lat.x, group=group)) +
geom_polygon(aes(fill = count), color = "black") +
ggtitle("Frequency of mentions") +
theme(plot.title = element_text(lineheight=1, face="bold"))
map1
map2 <- map1 + scale_fill_gradient(name = "Frequency Response", low = "blue", high = "red", na.value = "grey50")+
theme(axis.text.x = element_blank(),
axis.text.y = element_blank(),
axis.ticks = element_blank(),
axis.title.y=element_blank(),
axis.title.x=element_blank(),
rect = element_blank())
map2
A snipped of my mapdata dataset is: (where count is then the frequency the country was mentioned)我的地图数据集的片段是:(其中 count 是提到该国家/地区的频率)
long.x lat.x group order region subregion long.y lat.y count
1 -69.89912 12.45200 1 1 Aruba <NA> <NA> <NA> NA
2 -69.89571 12.42300 1 2 Aruba <NA> <NA> <NA> NA
3 -69.94219 12.43853 1 3 Aruba <NA> <NA> <NA> NA
Thanks for any advice and help!感谢您的任何建议和帮助!
I haven't used it I'm afraid, but the packcircles
package in combination with ggplot2 looks promising?恐怕我还没有使用过它,但是
packcircles
package 与 ggplot2 的结合看起来很有前途?
https://r-graph-gallery.com/circle-packing.html https://r-graph-gallery.com/circle-packing.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.