[R] Invalid 'yscale' in viewport
Erin McMullen Jonaitis
jonaitis at wisc.edu
Wed Nov 9 21:15:37 CET 2011
Never mind, I found it -- I had some NA values I didn't know about! I will infer that viewport doesn't handle NA values gracefully! (If I'm wrong about that and I've just missed something key, please correct me.)
From: R. Michael Weylandt [mailto:michael.weylandt at gmail.com]
Sent: Wednesday, November 09, 2011 12:45 PM
To: Erin Jonaitis
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Invalid 'yscale' in viewport
1) It sounds like you are right in thinking there's something funny
about your particular data: could you provide it to us? The easiest
way to do so is to use dput() to get a plain text representation ready
for copy and paste.
2) What is esplot()? It's not in base R, but I imagine you are
referring to Deepayn's script here:
http://www.stat.wisc.edu/~deepayan/771/esplot.R ? Just to confirm in
case there is something that needs looking at in the code.
On Wed, Nov 9, 2011 at 10:20 AM, Erin Jonaitis <jonaitis at wisc.edu> wrote:
> 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
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help