R中的轮廓图

时间:2015-12-15 16:33:14

标签: r plot contour

我有一个数据集 countnp ,其中有3列如下:

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QQuickView  *view = new QQuickView ();
    QWidget *container = QWidget::createWindowContainer(view);

    CustomItem *customitem = new CustomItem();///how can i set it view 
    container->show();

    return app.exec();
}

等等。时间部分的值范围为0到7.现在,我想创建时间与部分的等高线图,但是我我得到一个错误说 - 增加'x'和'y'值预期。此处时间部分都无法同时排序。请帮我解决一下这个。 我正在使用的代码:

>countnp
Time  Sections  Count
   0         0    370
   1         0      9
   1         1    127
   1         2    119
   1         3     55
   1         4     34
   1         5     55

1 个答案:

答案 0 :(得分:1)

contour()函数需要一个矩阵z,您可以在帮助文件中或在 MLavoie 提供的链接后看到。

或者,您可以使用contourplot()包中的lattice函数。

countnp <- data.frame(
  Time = c(0, 1, 1, 1, 1, 1, 1), 
  Sections = c(0, 0, 1, 2, 3, 4, 5), 
  Count = c(370, 9, 127, 119, 55, 34, 55))

library(lattice)
contourplot(Count ~ Time + Sections, data=countnp)
相关问题