briandk / granovaGG

Bob Pruzek and Jim Helmreich's implementation of Elemental Graphics for Analysis of Variance
Other
15 stars 4 forks source link

granova.1w.ggplot produces text coercion errors #60

Closed briandk closed 13 years ago

briandk commented 13 years ago

Warnings are coming of the form:

1: In validDetails.text(x) : NAs introduced by coercion
2: In validDetails.text(x) : NAs introduced by coercion
3: In validDetails.text(x) : NAs introduced by coercion
4: In validDetails.text(x) : NAs introduced by coercion
5: In validDetails.text(x) : NAs introduced by coercion

I suspect the issue is caused by geom_text calls passing in strings (such as "left", "right", and "center") for parameter values to hjust and just:

OverplottedGroupLabels <- function(owp) {
  if (TRUE %in% owp$group.labels$overplotted) {
    return(geom_text(
             aes(x     = x,
                 y     = y,
                 label = label,
                 angle = angle
             ),
           size  = GetGroupLabelSize(),
           color = brewer.pal(n = 8, name = "Paired")[6],
           hjust = "left",
           vjust = "top",
           data  = subset(owp$group.labels, overplotted == TRUE)
           )
    )
  }
}
WilDoane commented 13 years ago

any idea which part of the function is causing a call to

```r
validDetails.text(...)


?

-Wil

William Doane
http://DrDoane.com

On 2011 Aug 12, at 14:57, briandk wrote:

> validDetails.text
briandk commented 13 years ago

Wil, I suspect the issue is essentially what our Stack Overflow exchange was about. In short, you can't do this:

theme_text(vjust="centre")

because theme_text() won't properly handle string values for justification parameters, even though textGrob() will.

briandk commented 13 years ago

So far, it appears hjust=0 is equivalent to hjust="left"

briandk commented 13 years ago

Scratch that. hjust=0.5 is equivalent to hjust="left". My mistake.