Skip to content

Ignoring unknown aesthetics warning in geom_tile() #2066

Closed

Description

@vadimus202

Unanticipated warning displayed below. The height and width aesthetics are definitely used and not ignored.
Thanks!

library(ggplot2)

df <- data.frame(
    x = rep(c(2, 5, 7, 9, 12), 2),
    y = rep(c(1, 2), each = 5),
    z = factor(rep(1:5, each = 2)),
    w = rep(diff(c(0, 4, 6, 8, 10, 14)), 2)
)
ggplot(df, aes(x, y)) +
    geom_tile(aes(fill = z, width = w), colour = "grey50")
#> Warning: Ignoring unknown aesthetics: width

Activity

  1. DataStrategist commented on Apr 5, 2017

    @DataStrategist

    Me as well. I'm getting the warning, but the width is definitely NOT ignored:

          geom_bar(aes(y=Perc,width=0.15,fill=BehindBy),stat = "identity")  + 
          scale_fill_gradient(limits = c(LowLVL,0),low="red", high="green") +
          geom_point(aes(y=OldPer),shape=6,size=5) +
          geom_text( y=1,aes(label = tex2),vjust=2,hjust = 0) +
          geom_bar(aes(y=100,width=0.5),alpha=0.25,stat = "identity") +
          geom_text( y=1,aes(label = tex),vjust=-1.5,hjust = 0) +
          geom_hline(yintercept = OngoingDF$Perc.time[1],alpha=0.33) +
          annotate("text", x = 0, y = OngoingDF$Perc.time[1] + 1.5,hjust=0, label = "Today",angle=90,alpha=0.33) +
          coord_flip() +  
          ylab("Percent of yearly target & Percent of year") +   xlab(" ") +
          ggtitle(paste("Ongoing Indicator accomplishment (",forYear,")",sep=""))+
          theme_minimal() + theme(axis.text.y = element_text(size=15,face="bold"),
                                  axis.title.x = element_text(face="bold", size=15),
                                  title=element_text(face="bold",size=20))
    Warning: Ignoring unknown aesthetics: width
    Warning: Ignoring unknown aesthetics: width
    

    yields:
    image

    while:

          geom_bar(aes(y=Perc,fill=BehindBy),stat = "identity")  + 
          scale_fill_gradient(limits = c(LowLVL,0),low="red", high="green") +
          geom_point(aes(y=OldPer),shape=6,size=5) +
          geom_text( y=1,aes(label = tex2),vjust=2,hjust = 0) +
          geom_bar(aes(y=100),alpha=0.25,stat = "identity") +
          geom_text( y=1,aes(label = tex),vjust=-1.5,hjust = 0) +
          geom_hline(yintercept = OngoingDF$Perc.time[1],alpha=0.33) +
          annotate("text", x = 0, y = OngoingDF$Perc.time[1] + 1.5,hjust=0, label = "Today",angle=90,alpha=0.33) +
          coord_flip() +  
          ylab("Percent of yearly target & Percent of year") +   xlab(" ") +
          ggtitle(paste("Ongoing Indicator accomplishment (",forYear,")",sep=""))+
          theme_minimal() + theme(axis.text.y = element_text(size=15,face="bold"),
                                  axis.title.x = element_text(face="bold", size=15),
                                  title=element_text(face="bold",size=20))
    

    yields:
    image

  2. npjc commented on Apr 30, 2017

    @npjc

    👍 same here.

    My reprex and info:

    library(ggplot2)

    from geom_tile examples:

    df <- data.frame(x = rep(c(2, 5, 7, 9, 12), 2), y = rep(c(1, 2), each = 5), 
      z = factor(rep(1:5, each = 2)), w = rep(diff(c(0, 4, 6, 8, 10, 14)), 2))
    ggplot(df, aes(x, y)) + geom_tile(aes(x = x, y = y, fill = z, width = w), colour = "grey50", 
      width = 3)
    #> Warning: Ignoring unknown aesthetics: width

    Session Info

    sessioninfo::session_info()
    #> ─ Session info ──────────────────────────────────────────────────────────
    #>  setting  value                       
    #>  version  R version 3.4.0 (2017-04-21)
    #>  os       macOS Sierra 10.12.4        
    #>  system   x86_64, darwin15.6.0        
    #>  ui       X11                         
    #>  language (EN)                        
    #>  collate  en_CA.UTF-8                 
    #>  tz       America/Chicago             
    #>  date     2017-04-30                  
    #> 
    #> ─ Packages ──────────────────────────────────────────────────────────────
    #>  package     * version    date       source                             
    #>  backports     1.0.5      2017-01-18 CRAN (R 3.4.0)                     
    #>  bitops        1.0-6      2013-08-17 CRAN (R 3.4.0)                     
    #>  clisymbols    1.1.0      2017-01-27 cran (@1.1.0)                      
    #>  colorspace    1.3-2      2016-12-14 CRAN (R 3.4.0)                     
    #>  digest        0.6.12     2017-01-27 CRAN (R 3.4.0)                     
    #>  evaluate      0.10       2016-10-11 CRAN (R 3.4.0)                     
    #>  formatR       1.5        2017-04-25 CRAN (R 3.4.0)                     
    #>  ggplot2     * 2.2.1      2016-12-30 CRAN (R 3.4.0)                     
    #>  gtable        0.2.0      2016-02-26 CRAN (R 3.4.0)                     
    #>  htmltools     0.3.5      2016-03-21 CRAN (R 3.4.0)                     
    #>  knitr         1.15.1     2016-11-22 CRAN (R 3.4.0)                     
    #>  labeling      0.3        2014-08-23 CRAN (R 3.4.0)                     
    #>  lazyeval      0.2.0      2016-06-12 CRAN (R 3.4.0)                     
    #>  magrittr      1.5        2014-11-22 CRAN (R 3.4.0)                     
    #>  munsell       0.4.3      2016-02-13 CRAN (R 3.4.0)                     
    #>  plyr          1.8.4      2016-06-08 CRAN (R 3.4.0)                     
    #>  Rcpp          0.12.10    2017-03-19 CRAN (R 3.4.0)                     
    #>  RCurl         1.95-4.8   2016-03-01 CRAN (R 3.4.0)                     
    #>  rmarkdown     1.5        2017-04-26 CRAN (R 3.4.0)                     
    #>  rprojroot     1.2        2017-01-16 CRAN (R 3.4.0)                     
    #>  scales        0.4.1      2016-11-09 CRAN (R 3.4.0)                     
    #>  sessioninfo   0.0.0.9000 2017-04-26 Github (r-pkgs/sessioninfo@0a5b58f)
    #>  stringi       1.1.5      2017-04-07 CRAN (R 3.4.0)                     
    #>  stringr       1.2.0      2017-02-18 CRAN (R 3.4.0)                     
    #>  tibble        1.3.0      2017-04-01 CRAN (R 3.4.0)                     
    #>  withr         1.0.2      2016-06-20 CRAN (R 3.4.0)                     
    #>  XML           3.98-1.6   2017-03-30 CRAN (R 3.4.0)                     
    #>  yaml          2.1.14     2016-11-12 CRAN (R 3.4.0)
  3. hadley commented on Jun 1, 2017

    @hadley
    Member

    Duplicate of #1904

  4. locked as resolved and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions