[英]White lines in gradient.rect from R's plotrix package
Anybody have a solution for removing the white lines seen here in the graduated rectangles at the top of the plot? 有人有解决方案,可以删除在图顶部渐变矩形中看到的白线吗? These are produced with gradient.rect
from the plotrix
package. 这些是从plotrix
包中使用gradient.rect
生产的。
gradient.rect(as.Date("1979-05-04"),70,as.Date("1990-11-28"),80,col=smoothColors("royalblue",100.0,"white"),border=NA,gradient="x")
They appear both in the output from RStudio and in the exported PNG. 它们既出现在RStudio的输出中,也出现在导出的PNG中。
I was able to reproduce the problem (although not that image) with this code: 我可以使用以下代码重现问题(尽管不是该图像):
png();plot(x=seq(as.Date("1979-05-04"),as.Date("1990-11-28"),length=50),
1:50,type="n",axes=FALSE) # set up plot coords correctly
plotrix::gradient.rect(as.Date("1979-05-04"),5, as.Date("1990-11-28"),6,
col=plotrix::smoothColors("royalblue", 100.0,"white"),
border=NA,gradient="x",nslices=121);
dev.off()
Then I saw three thin, white vertical bands. 然后我看到了三个细的白色垂直条带。 I looked at the RGB values and plotted their hexadecimal equivalents: 我查看了RGB值并绘制了它们的十六进制等效项:
plot(NA, xlim=c(1,110),ylim=c(0x4169E1, 0xFFFFFF) )
lines(1:102, as.numeric(
paste0('0x',
substr( plotrix::smoothColors("royalblue",100.0,"white"),
2,7)
) ) )
I noticed that there were uneven gaps in the sequences so tried using smaller number of colors with better success: 我注意到序列中存在不均匀的间隙,因此尝试使用更少的颜色获得更好的成功:
png(); plot(x=seq(as.Date("1979-05-04"),as.Date("1990-11-28"),length=50),1:50,type="n",axes=FALSE)
plotrix::gradient.rect(as.Date("1979-05-04"),20,as.Date("1990-11-28"),30,
col=plotrix::smoothColors("royalblue",55,"white"),border=NA,gradient="x");dev.off()
I don't really understand why this happens. 我真的不明白为什么会这样。 You might contact Jim Lemon if you need an explanation ... rather than just a fix strategy. 如果您需要解释...而不只是解决策略,可以与Jim Lemon联系。 His email address should appear at your R console if you type: maintainer("plotrix")
如果您键入以下内容,则他的电子邮件地址应显示在R控制台上: maintainer("plotrix")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.