小编Zet*_*ina的帖子

带 R 的圆形气泡图

我想在 R 中重现以下情节:

气泡图

我现在使用packcircles包,并且能够创建图中的绘图:

包圈图

使用以下代码:

require(packcircles)
res <- circleLayout(xyr, limits, limits, maxiter = 1000)
dat <- circlePlotData(res$layout)

doPlot <- function(dat, title)
ggplot(dat) + 
geom_polygon(aes(x, y, group=id), colour="tomato", fill="tomato", alpha=0.3) +
coord_equal(xlim=limits, ylim=limits) +
theme_bw() +
theme(axis.text=element_blank(),
    axis.ticks=element_blank(),
    axis.title=element_blank()) +
labs(title=title)

doPlot(dat, "")
Run Code Online (Sandbox Code Playgroud)

其中xyr是以下形式的数据框:

          x           y    r
1  2.897344 -10.4161236 0.57
2  1.932411  13.0631120 0.52
3  6.839500 -11.0507209 0.52
4 11.117047 -17.6440597 0.77
5 22.395529  -0.6191146 0.45
6 20.313309 -13.3292887 0.69
Run Code Online (Sandbox Code Playgroud)

以及表单的输出数据:

         x         y id
1 …
Run Code Online (Sandbox Code Playgroud)

geometry drawing bubble-chart r data-visualization

5
推荐指数
0
解决办法
5051
查看次数

标签 统计

bubble-chart ×1

data-visualization ×1

drawing ×1

geometry ×1

r ×1