[R] Postscript Legends (or not)

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Jun 22 15:42:19 CEST 2000


"Anon." wrote:
> 
> I discovered a little problem when using the Windows NT release of R
> 1.0.1, and it's still there in R 1.1.0.
> 
> The boiled down version is this:  I want to draw the following plot and
> put it into a Postscript file:
> 
> x <- c(1,2,3,4); y1 <- c(1,2,3,4); y2 <- c(2,2,2,2)
> Fred <- c(1,2)
> 
> postscript(file="d:/Bob/Papers/IFM/try2.ps")
> plot(x,y1, type="l")
> lines(x,y2,lty="33")
> legend(1,4, c("y1","y2"), lty=Fred)
> graphics.off()
> 
> This works fine.  However, if I use Fred <- c(1,"33"), I get an error
> when trying to view hte file (using either Ghostscript or CorelDraw).
> GhostScript gives me the message that I've included below.
> 
> Is this a bug, or am I missing something?


In your first example "Fred" is numeric, in the second it is character:

  > c(1, "33")
  [1] "1"   "33"


As a simple workaround try:

  > c("solid", "33")



The same problem occurs here:

  > postscript(file="test.ps")
  > plot(1:10)
  > lines(2:3, 5:6, lty="1")
  > dev.off()

(WinNT4.0, R-1.1.0)

Looks like the postscript device don't convert the character "1" to
solid and also gives no warning message ...

Regards,
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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