在ggplot2中增加圆的半径

时间:2018-06-27 16:56:52

标签: r ggplot2

我在增加地图上圆的半径时遇到了麻烦。我尝试了最大尺寸最大为scale_size_continuous的{​​{1}},但是圆圈的大小毕竟还是一样。

我的代码如下:

states <- map_data("state")

gg1 <- ggplot(data=states) +
  geom_polygon(data=states, aes(x=long,y=lat,group=group), 
               fill = "orange", color = "white") + 
  coord_fixed(ratio = 1.3)+
  geom_circle(data = origCity, aes(x0 = Long, y0 = Lat, r = Percent), 
              fill = "black", color = "black", alpha = 0.5, show.legend = FALSE) +
  scale_size_continuous(range = c(20, 5))+
  theme(panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(), 
        panel.background = element_blank())+
  theme(axis.ticks.x = element_blank(),
        axis.title.x = element_blank(),
        axis.text.x = element_blank())+
  theme(axis.ticks.y = element_blank(),
        axis.title.y = element_blank(),
        axis.text.y = element_blank())

print(gg1)

任何建议都将不胜感激!

0 个答案:

没有答案