[R] test if something was plotted on pdf device
PIKAL Petr
petr@p|k@| @end|ng |rom prechez@@cz
Thu Sep 12 13:10:02 CEST 2019
Dear all
Is there any simple way checking whether after calling pdf device something was plotted into it?
In interactive session I used
if (dev.cur()==1) plot(ecdf(rnorm(100))) else plot(ecdf(rnorm(100)), add=T, col=i)
which enabled me to test if plot is open
But when I want to call eg. pdf("test.pdf") before cycle
dev.cur()==1 is FALSE even when no plot is drawn and plot.new error comes.
> pdf("test.pdf")
if (dev.cur()==1) plot(ecdf(rnorm(100))) else plot(ecdf(rnorm(100)), add=T, col=i)
Error in segments(ti.l, y, ti.r, y, col = col.hor, lty = lty, lwd = lwd, :
plot.new has not been called yet
Best regards
Petr
Osobn? ?daje: Informace o zpracov?n? a ochran? osobn?ch ?daj? obchodn?ch partner? PRECHEZA a.s. jsou zve?ejn?ny na: https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about processing and protection of business partner's personal data are available on website: https://www.precheza.cz/en/personal-data-protection-principles/
D?v?rnost: Tento e-mail a jak?koliv k n?mu p?ipojen? dokumenty jsou d?v?rn? a podl?haj? tomuto pr?vn? z?vazn?mu prohl??en? o vylou?en? odpov?dnosti: https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/
[[alternative HTML version deleted]]
More information about the R-help
mailing list