Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Performance 如果输入较大的数字,R金字塔图非常慢_Performance_R_Plot - Fatal编程技术网

Performance 如果输入较大的数字,R金字塔图非常慢

Performance 如果输入较大的数字,R金字塔图非常慢,performance,r,plot,Performance,R,Plot,我正在尝试用R做一个金字塔图。我在互联网上找到了一个示例代码,它可以满足我的需要。问题是,我没有像示例中那样处理小数字。我的图的值为3000000到12000000,但每边只有10条。永远不需要花费更少的时间来创建具有更大数字的绘图,并且输出的pdf文件大小约为800mb pyramid.plot(x,y,labels=groups,main=“Performance”,lxcol=mcol,rxcol=fcol,gap=0.5,show.values=TRUE) 为什么表演这么差?不应该自动缩

我正在尝试用R做一个金字塔图。我在互联网上找到了一个示例代码,它可以满足我的需要。问题是,我没有像示例中那样处理小数字。我的图的值为3000000到12000000,但每边只有10条。永远不需要花费更少的时间来创建具有更大数字的绘图,并且输出的pdf文件大小约为800mb

pyramid.plot(x,y,labels=groups,main=“Performance”,lxcol=mcol,rxcol=fcol,gap=0.5,show.values=TRUE)

为什么表演这么差?不应该自动缩放吗

更新:

pdf(file='figure1.pdf')
library(plotrix)

x <-c(3105000,3400001,4168780,2842764,3543116,4224601,4222222,6432105,9222222,12345596)
y <-c(3105000,3400001,4168780,2842764,3543116,4224601,4222222,6432105,9222222,12345596)
groups <-c("g1","g2","g3","g4","g5","g6","g7","g8","g9","g11") 
pyramid.plot(x,y,labels=groups,main="Performance",gap=0.5,show.values=TRUE)
dev.off()
pdf(file='figure1.pdf')
库(plotrix)

x在内部,
pyramid.plot
正在尝试做一些事情来欺骗轴,以解释中间的间隙:如果执行
调试(pyramid.plot)
并逐行检查,您会发现问题出在哪里:

if (is.null(laxlab)) {
            laxlab <- seq(xlim[1] - gap, 0, by = -1)
            axis(1, at = -xlim[1]:-gap, labels = laxlab)
        }

还有一些其他的迹象表明,
pyramid.plot
是为人口统计图设计的。。。您可能会写信给软件包维护人员,请他考虑将轴的设计推广一点……

您的示例不可复制,因此很难回答。请告诉我们以下内容:1)哪个包是
pyramid.plot
?2) 根据
str(x)
str(y)
@Andrie的搜索结果,快速搜索返回
pyramid.plot
位于
plotrix
中。调用
PDF()
保存到磁盘时,创建一个800mb PDF听起来像是英寸/像素的混合。我猜这是真正慢的部分,而不是
金字塔.plot
调用。但从这个问题上不可能确定。我想把所有“不可复制”的评论向上投一次票,但我不能。完全合理的问题,但不可复制!附言
pyramid.plot(x,y,labels=groups,
             main="Performance",gap=5e5,show.values=TRUE,
             laxlab=seq(0,1e7,by=1e6),raxlab=seq(0,1e7,by=1e6))