小编gro*_*sgr的帖子

plot/ggplot2 - 填充太多点的区域

最终实施 - 没有完成,但正确的方向

想法/问题:您有一个包含许多重叠点的图,并希望用平坦区域替换它们,因此提高了查看绘图的性能.

可能的实现:计算所有点之间的距离矩阵并连接指定距离以下的所有点.

待办事项/未完成:此功能目前适用于手动设置的距离,具体取决于打印图的大小.我在这里停下来因为结果不符合我的审美意识.

中间图的最小例子

set.seed(074079089)
n.points <- 3000

mat <- matrix(rnorm(n.points*2, 0,0.2), nrow=n.points, ncol=2)
colnames(mat) <- c("x", "y")

d.mat <- dist(mat)
fit.mat <-hclust(d.mat, method = "single")
lims <- c(-1,1)
real.lims <- lims*1.1               ## ggplot invokes them approximately

# An attempt to estimate the point-sizes, works for default pdfs pdf("test.pdf")
cutsize <- sum(abs(real.lims))/100  
groups <- cutree(fit.mat, h=cutsize) # cut tree at height cutsize
# plot(fit.mat) # display dendogram

# draw dendogram with red borders around …
Run Code Online (Sandbox Code Playgroud)

plot r ggplot2

6
推荐指数
1
解决办法
899
查看次数

标签 统计

ggplot2 ×1

plot ×1

r ×1