- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
> d
[,1] [,2]
1 -0.5561835 1.49947588
2 -2.3985544 3.07130217
3 -3.8833659 -4.29331711
4 3.1025836 5.45359160
5 0.7438354 -2.80116065
6 7.0787294 -2.78121213
7 -1.6633598 -1.17898157
8 -0.6751930 0.03466162
9 1.4633841 0.50173157
10 -3.2118758 0.49390863
require(MASS) # for sammon using which i generated the above coordinates
require(deldir) # for voronoi tessellations
dd <- deldir(d[,1], d[,2]) # voronoi tessellations
plot(dd,wlines="tess") # This will give me tessellations
最佳答案
我理解它的方式(我的意思是如果我正确理解你的问题),因为 plot.deldir
允许参数 add=TRUE
要通过,可以直接做。
d<-structure(list(V1 = c(-0.5561835, -2.3985544, -3.8833659, 3.1025836, 0.7438354,
7.0787294, -1.6633598, -0.675193, 1.4633841, -3.2118758), V2 =
c(1.49947588, 3.07130217, -4.29331711, 5.4535916, -2.80116065,
-2.78121213, -1.17898157, 0.03466162, 0.50173157, 0.49390863)), .Names =
c("V1","V2"), class = "data.frame", row.names = c(NA, -10L))
library(MASS)
library(deldir)
dd <- deldir(d[,1], d[,2])
plot(dd, wlines="tess")
plot.deldir
中的多边形需要更多的处理,我之前认为它需要更多的处理。逐行绘制,而不是一个接一个的多边形,因此线的顺序在
dd$dirsgs
中打乱.
ddd <- as.matrix(dd$dirsgs[dd$dirsgs$ind2==1,1:4])
d1poly <- rbind(ddd[1,1:2],ddd[1,3:4])
for( i in 2:nrow(ddd)){
x <- ddd[ddd[,1]==d1poly[i,1], 3:4]
d1poly <- rbind(d1poly, x)
}
d1poly
x2 y2
-2.096990 1.559118
0.303986 4.373353
x 1.550185 3.220238
x 0.301414 0.692558
x -1.834581 0.866098
x -2.096990 1.559118
splancs
在感兴趣的多边形中创建一些随机数据:
library(splancs)
rd <- csr(as.matrix(d1poly),10) # For 10 random points in the polygon containing point 1
rd
xc yc
[1,] -1.6904093 1.9281052
[2,] -1.1321334 1.7363064
[3,] 0.2264649 1.3986126
[4,] -1.1883844 2.5996515
[5,] -0.6929208 0.8745020
[6,] -0.8348241 2.3318222
[7,] 0.9101748 1.9439797
[8,] 0.1665160 1.8754703
[9,] -1.1100710 1.3517257
[10,] -1.5691826 0.8782223
rdd <- deldir(c(rd[,1],d[1,1]),c(rd[,2],d[1,2]))
# don't forget to add the coordinates of your point 1 so it s part of the sub-tessellation
plot(dd, wlines="tess")
plot(rdd, add=TRUE, wlines="tess")
plot(dd, wlines="tess", col="white", wpoints="none")
plot(rdd, wlines="tess", add=TRUE)
plotlim <- cbind(par()$usr[c(1,2,2,1)],par()$usr[c(3,3,4,4)])
extpoly <- rbind(plotlim, d1poly)
#Here the first point of d1poly is oriented toward the upper left corner: if it is oriented otherwise the order of plotlim has to be changed accordingly
polygon(extpoly, border=NA, col="white")
plot(dd, wlines="tess", add=TRUE)
关于r - r 中绘图区域内的子绘图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14833285/
我正在尝试编写一个函数来制作绘图并将其自动保存到文件中。 我努力用它来动态地做的技巧[plotname=varname & filename=varname &], 并使其与从循环中调用它兼容。 #
有人可以帮助我如何在绘图条形图中添加“下拉”菜单。 我在以下链接 ( https://plot.ly/python/v3/dropdowns/ ) 上找到了一些信息,但我正在努力调整代码,因此下拉选项
我不确切知道如何表达这一点,但我本质上希望根据其他数据之前的列值将数据分组为 Excel 图的系列。例如: size weight apple 3 35 orange 4
我正在为出版物创建图表并希望它们具有相同的字体大小。 当我用多图创建图形时,字体大小会减小,即使我没有更改tiff() 分辨率或pointsize 参数。我根据最终适合的地 block 数量增加了图形
我用 glm::perspective(80.0f, 4.0f/3.0f, 1.0f, 120.0f);并乘以 glm::mat4 view = glm::lookAt( glm::vec3(
我在 Shiny UI 中有一个情节。如果我更改任何输入参数并且通过 react 性图将会改变。但是让我们考虑以下情况:- Shiny UI 中的绘图可以说股票的日内价格变动。为此,您查询一些实时数据
我对 R 有点陌生。我在以下两个线程中跟踪并实现了结果: http://tolstoy.newcastle.edu.au/R/e17/help/12/03/7984.html http://lukem
我想在 WPF 控件中使用 GDI+ 绘图。 最佳答案 有多种方法可以做到这一点,最简单的方法是锁定您使用 GDI 操作的位图,获取像素缓冲区(从锁定中获取的 BitmapData 中的 Scan0
如何在以下取自其网站的绘图示例中隐藏颜色条? df % layout(title = '2014 Global GDPSource:CIA World Factbook',
我有两列数据,X 和 Y,每个条目在两个向量的小数点后都有 4 位数据。 当我使用 plot(x,y) 绘制简单图时,轴上显示的数据精确到小数点后两位。如何在两个轴上将其更改为小数点后 4 位精度?
我目前正在使用 Canvas 处理 JavaFX-Drawing-Application。在 GraphicsContext 的帮助下,我使用 beginPath() 和 lineTo() 方法绘制线
如果这个问题已经得到解答,但我无法找到我需要的东西,我提前道歉。我想从名为 data1.dat、data2.dat 的文件中绘制一些结果......我设法通过循环导入数据,但我无法使用循环绘制结果。仅
我的 pandas 数据框中有一个功能,可以(可能)具有多个级别。我可以使用以下方法获得独特的级别: reasons = df["Reason"].unique() 我可以通过执行以下操作在单个图表上
我在 Ubuntu 14 和 Windows 7(均为 64 位)中用 Python 绘制结果时遇到问题。作为一个简单的比较,我做了: from tvb.simulator.lab import *
以下代码相当简单 - 它用随机选择的像素填充设计表面 - 没什么特别的(暂时忽略第二种方法中的 XXXXXXX)。 private void PaintBackground() { Rando
我正在尝试制作一个绘制函数图形的 swing 应用程序(现在很简单,例如 x+2)但我在根据屏幕坐标制作我的点的数学坐标时遇到问题。我希望它在我的图表中简单地画一条从 P1(0,1) 到 P2(1,2
编辑 4:问题的新格式 背景:我有一个扩展 JFrame 的类 Window,在 JFrame 中我有一个 Canvas 。我向 Canvas 添加自定义对象。这个对象的唯一目的(为了争论)是在 Ca
我需要为即将到来的锦标赛标记阶梯,但我找不到任何方法来语义标记它。到目前为止我看到的唯一方法是 mark it up as a table ,我想不惜一切代价避免这种情况。 有什么想法吗? 最佳答案
我目前正在为一个小型 uC 项目编写 UI。在计算垂直线的位置时遇到一些问题。这个想法是将红线沿 x 轴移动到矩形的末端。 使用无限旋转编码器递增的值,范围为 0 到 800,增量为 1。矩形的左侧是
我正在尝试绘制光分布图。我想准确地执行此问题的第一步所要求的:Statistical analysis on Bell shaped (Gaussian) curve . 现在我有一组值。我希望数组元
我是一名优秀的程序员,十分优秀!