[R] postscript and lty
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Thu Feb 1 14:30:13 CET 2001
Torsten Hothorn <Torsten.Hothorn at rzmail.uni-erlangen.de> writes:
> To the plot experts:
>
> when creating a plot containing different lines, each with a special line
> type, it may happen that the result of 'postscript()' is not readable by
> ghostview (which may not be an R error, thus not bug report ;-).
It's a bug alright:
0.75 setlinewidth
[ 0.00] 0 setdash <------- Invalid PostScript
> This is the case when mixing lty as 0:6 and character or even when
> using lty as character only.
>
> Example:
>
> postscript("test.ps")
> plot(1:10, type="l", lty=1)
> lines(sample(10), lty="9A1A1A")
> lines(sample(10), lty="1A6A7A")
> lines(sample(10), lty="9B")
> lines(sample(10), lty="1F")
> legend(4,4,paste("test", 1:5), lty=c(1, "9A1A1A","1A6A7A","9B","1F"))
> dev.off()
>
A fundamental problem here is that c(1, "9A1A1A","1A6A7A","9B","1F")
will coerce the 1 to character, and line type "1" is causing the
trouble with postscript. Simpler version of same problem is
postscript('test.ps')
plot(1:10,type="l",lty="1")
The workaround is
legend(4,4,paste("test", 1:5), lty=c("0", "9A1A1A","1A6A7A","9B","1F"))
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list