ggmap中的Voronoi镶嵌与自定义颜色代码?

问题描述

我一直在尝试在 ggmap 中绘制 voronoi 细分,其中每个块的颜色将被赋予十六进制代码,例如 #FFCC00。到目前为止,我想出的代码如下:

Warning message:
computation Failed in `stat_voronoi_tile()`:
There is at most one point,data or dummy,inside
the given rectangular window. Thus there are
insufficiently many points to triangulate/tessellate. 

但是,当我添加 .Box::before,.Box::after { content: ""; position: absolute; z-index: -1; top: 0; left: 0; right: 0; bottom: 0; background-color: #ff0000; clip-path: polygon(0 0%,100% 15%,100% 85%,0 100%); } .Box::after { background-color: #3f3f3f; transform: scaleX(-1); /* the shape is the same so I simple invert it but you can apply another clip-path here */ } .Box { padding:50px; display:inline-block; position:relative; } 参数时,出现错误警告:

<div class="Box">
  <h1>Hello World</h1>
</div>

我不确定如何修复,因为在添加参数之前,地图显示没有错误。因此我的问题是:如何将自定义颜色编码的 voronoi 镶嵌添加到 ggmap 上?

提前致谢!

解决方法

问题可能在于 geom_voronoi_tile 期望 voronoi 多边形是闭合的,而您的数据集缺少外部边界。 一个快速的替代方法是回退到 ggvoronoi::geom_voronoi()。

std::deque

enter image description here

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...