[R] Invalid 'yscale' in viewport
Erin McMullen Jonaitis
jonaitis at wisc.edu
Wed Nov 9 21:04:45 CET 2011
Thanks for your quick response, Michael. That is indeed the script I was talking about -- I didn't see it in a standard package, so I just copied it and ran it as a standalone thing.
I'm afraid the data are proprietary (human subjects, health data) and so I can't share them. I was able to confirm, though, that it must be something funny about my data -- I tried the esplot() code again with some data I generated by creating random dates, subtracting them, and converting them back to numeric, and that worked just fine. I will take a look at my data more closely and see if anything strikes me. I haven't worked with dates that much in the past, so I'm a bit naïve about what could be wrong; if you can think of any common pitfalls, I would be happy to know.
Many thanks,
Erin
-----Original Message-----
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
Two things:
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.
Thanks,
Michael
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
> puzzlement.
>
> 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
> 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.
>
More information about the R-help
mailing list