The problem is the ``paper="special" '' specification in your eps() function.

This makes par("pin"), which eqcsplot() uses in its calculations, undefined.
The ``value'' thus produced is:

[1] NaN NaN

Which makes perfect sense if you think about it.

If you're going to use paper=special, you need to specify "height" and "width".

    cheers,

            Rolf Turner

On 02/06/11 07:17, Michael Friendly wrote:
[Env: R 2.12.2, Win XP]

I'm creating figures using MASS::eqcsplot to provide equal scaling of the axes. My figures work OK when I plot to the screen, but when I try to do the same plot as a postscript file, I get an
unexplicable error,

> figframe()
Error in if (yuin > xuin * ratio) yuin <- xuin * ratio else xuin <- yuin/ratio :
  missing value where TRUE/FALSE needed
> traceback()
2: eqscplot(x = 0, y = 0, xlim = xlim, ylim = ylim, xlab = xlab,
       ylab = ylab, type = "n")
1: figframe()
>

Here is a minimal source script exhibiting the problem:

library(MASS)

eps <- function(file="Rplot.eps", horizontal=FALSE, paper="special", ...) { postscript(file=file, onefile=FALSE, horizontal=horizontal, paper=paper, ...)
  }


# Figure frame
figframe <- function( xlim = c(-3,3), ylim = c(-3,3), xlab = '', ylab = '') { eqscplot( x=0,y=0, xlim = xlim, ylim = ylim, xlab = xlab, ylab = ylab, type = 'n')
    abline( v=0, col="gray")
    abline( h=0, col="gray")
}

# screen: OK
op <- par(mar=c(3, 3, 1, 1) + 0.4)
figframe()
par(op)

# eps: fails
eps(file="test1.eps")
op <- par(mar=c(3, 3, 1, 1) + 0.4)
figframe()
par(op)
dev.off()

I know this worked under an earlier version, probably ~ R 2.9.x


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to