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?
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")
debugging the code, the basic problem is that
rectis called for each cell … effectively creating a grid whether or not horizontal and vertical line segments are drawnI solved this (sort of) as follows:
addtable2plotx <- fix(addtable2plot)(opens an editor)if (hlines && vlines)beforerect(...on line 64 of the filere-make your plot using
addtable2plotxinstead ofaddtable2plot. (There still seem to be a few spurious lines there, but the rectangles are gone.)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
hlinesandvlinesarguments in the documentation (in which case a documentation tweak might be in order)