I am using addtable2plot()
in the plotrix
package. One peculiar problems is that I can't get rid of the table grid. The hlines
and vlines
options do not make any difference. What am I doing wrong?
我在plotrix包中使用addtable2plot()。一个特殊的问题是我无法摆脱表格。 hlines和vlines选项没有任何区别。我究竟做错了什么?
testdf<-data.frame(Before=c(10,7,5),During=c(8,6,2),After=c(5,3,4))
rownames(testdf)<-c("Red","Green","Blue")
barp(testdf,main="Test addtable2plot",ylab="Value",
names.arg=colnames(testdf),col=2:4)
# show most of the options
addtable2plot(2,8,testdf,bty="n",display.rownames=TRUE, hlines=FALSE, vlines=FALSE,title="The table")
1 个解决方案
#1
1
debugging the code, the basic problem is that rect
is called for each cell ... effectively creating a grid whether or not horizontal and vertical line segments are drawn
调试代码,基本问题是为每个单元调用rect ...有效地创建一个网格,无论是否绘制水平和垂直线段
I solved this (sort of) as follows:
我解决了这个问题(如下):
-
addtable2plotx <- fix(addtable2plot)
(opens an editor) - add
if (hlines && vlines)
beforerect(...
on line 64 of the file
addtable2plotx < - fix(addtable2plot)(打开一个编辑器)
在矩形之前添加if(hlines && vlines)(...在文件的第64行
re-make your plot using addtable2plotx
instead of addtable2plot
. (There still seem to be a few spurious lines there, but the rectangles are gone.)
使用addtable2plotx而不是addtable2plot重新制作你的情节。 (那里似乎还有一些虚假的线条,但矩形消失了。)
You might try contacting the package maintainer about this, to determine if this is a bug or if we're mis-reading the intention of the hlines
and vlines
arguments in the documentation (in which case a documentation tweak might be in order)
您可以尝试联系软件包维护者,以确定这是否是一个错误,或者我们是否错误地阅读了文档中hlines和vlines参数的意图(在这种情况下,可能需要进行文档调整)
#1
1
debugging the code, the basic problem is that rect
is called for each cell ... effectively creating a grid whether or not horizontal and vertical line segments are drawn
调试代码,基本问题是为每个单元调用rect ...有效地创建一个网格,无论是否绘制水平和垂直线段
I solved this (sort of) as follows:
我解决了这个问题(如下):
-
addtable2plotx <- fix(addtable2plot)
(opens an editor) - add
if (hlines && vlines)
beforerect(...
on line 64 of the file
addtable2plotx < - fix(addtable2plot)(打开一个编辑器)
在矩形之前添加if(hlines && vlines)(...在文件的第64行
re-make your plot using addtable2plotx
instead of addtable2plot
. (There still seem to be a few spurious lines there, but the rectangles are gone.)
使用addtable2plotx而不是addtable2plot重新制作你的情节。 (那里似乎还有一些虚假的线条,但矩形消失了。)
You might try contacting the package maintainer about this, to determine if this is a bug or if we're mis-reading the intention of the hlines
and vlines
arguments in the documentation (in which case a documentation tweak might be in order)
您可以尝试联系软件包维护者,以确定这是否是一个错误,或者我们是否错误地阅读了文档中hlines和vlines参数的意图(在这种情况下,可能需要进行文档调整)