[R] Invalid 'yscale' in viewport

Erin Jonaitis jonaitis at wisc.edu
Wed Nov 9 16:20:38 CET 2011

I tried Googling for help on this problem, but what I saw only increased my

I found a lovely bit of code called esplot() that makes scatterplots with
associated histograms and rug plots.  I have been trying to use it on my own
data, but the viewport routine on which it depends (I think) is choking on the
data I'm trying to plot.  

$ Error in valid.viewport(...) : Invalid 'yscale' in viewport

When I Google this error, I see that others get this message when trying to plot
dates.  However, my data are two numeric vectors.  The strange part is that
these vectors are in fact date differences -- they started life as dates -- but
I've already converted them to numeric, like so:

$ cogdiff <- as.numeric(cogdate - scandate)/365.24
$ labdiff <- as.numeric(labdate - scandate)/365.24

When I check is(cogdiff) and is(labdiff) it tells me that both are numeric
vectors.  And if I put these variables into other plotting routines (e.g.
plot(), qplot()), I get the expected output.  So on some level the conversion to
numeric has "worked."

However: as a sanity check I also tried the esplot() routine on two random
vectors I generated, and it DID work on those -- no error message.  So I don't
think I'm missing any other key dependencies.  Something else must be funny
about my cogdiff and labdiff variables, but I'm at a loss about what it could be
and am looking for suggestions.

Thanks in advance...

Erin Jonaitis

More information about the R-help mailing list