Skip to content

Legend of facet_wrap/ facet_grid is out of screen [fix-ggplot2 branch] #316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zippeurfou opened this issue Nov 30, 2015 · 4 comments
Closed

Comments

@zippeurfou
Copy link

Code:

library(reshape2)
library(plotly)
sp <- ggplot(tips, aes(x=total_bill, y=tip/total_bill)) + geom_point(shape=1)

# Divide by levels of "sex", in the horizontal direction
d<- sp + facet_grid(. ~ sex)

(dd<-ggplotly(d))

Screenshot:
https://infinit.io/_/3568W95

Note how total_bill, Male and Female can't be totally seen.

SessionInfo:

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] plotly_2.0.4       ggplot2_1.0.1.9003

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.2        digest_0.6.8       packrat_0.4.6-2    R6_2.1.1           grid_3.2.2         plyr_1.8.3         jsonlite_0.9.19    gtable_0.1.2       formatR_1.2.1      magrittr_1.5      
[11] scales_0.3.0       httr_1.0.0.9000    stringi_1.0-2      viridis_0.3.1      labeling_0.3       tools_3.2.2        stringr_1.0.0.9000 htmlwidgets_0.5    munsell_0.4.2      yaml_2.1.13       
[21] base64enc_0.1-3    colorspace_1.2-6   htmltools_0.2.6    knitr_1.11         gridExtra_2.0.0   
@cpsievert
Copy link
Collaborator

Hmm, I get a slightly different result, could you also show me the output of devtools::session_info()?

@zippeurfou
Copy link
Author

Sure:

devtools::session_info()
Session info -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.2.2 (2015-08-14)
 system   x86_64, darwin13.4.0        
 ui       RStudio (0.99.486)          
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       America/New_York            
 date     2015-11-30                  

Packages ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 package     * version     date       source                           
 assertthat    0.1         2013-12-06 CRAN (R 3.2.0)                   
 base64enc     0.1-3       2015-07-28 CRAN (R 3.2.0)                   
 colorspace    1.2-6       2015-03-11 CRAN (R 3.2.0)                   
 DBI           0.3.1       2014-09-24 CRAN (R 3.2.0)                   
 devtools      1.9.1.9000  2015-11-30 Github (hadley/devtools@b4edf3e) 
 digest        0.6.8       2014-12-31 CRAN (R 3.2.0)                   
 dplyr         0.4.3.9000  2015-11-30 Github (hadley/dplyr@4f2d7f8)    
 formatR       1.2.1       2015-09-18 CRAN (R 3.2.0)                   
 ggplot2     * 1.0.1.9003  2015-11-30 Github (hadley/ggplot2@23a748f)  
 ggvis         0.4.2       2015-06-06 CRAN (R 3.2.0)                   
 gridExtra     2.0.0       2015-07-14 CRAN (R 3.2.0)                   
 gtable        0.1.2       2012-12-05 CRAN (R 3.2.0)                   
 htmltools     0.2.6       2014-09-08 CRAN (R 3.2.0)                   
 htmlwidgets   0.5         2015-06-21 CRAN (R 3.2.0)                   
 httpuv        1.3.3       2015-08-04 CRAN (R 3.2.0)                   
 httr          1.0.0.9000  2015-11-30 Github (hadley/httr@733530e)     
 jsonlite      0.9.19      2015-11-28 CRAN (R 3.2.2)                   
 knitr         1.11        2015-08-14 CRAN (R 3.2.2)                   
 labeling      0.3         2014-08-23 CRAN (R 3.2.0)                   
 magrittr      1.5         2015-11-17 Github (smbache/magrittr@00a1fe3)
 memoise       0.2.1       2014-04-22 CRAN (R 3.2.0)                   
 mime          0.4         2015-09-03 CRAN (R 3.2.0)                   
 munsell       0.4.2       2013-07-11 CRAN (R 3.2.0)                   
 packrat       0.4.6-2     2015-11-25 Github (rstudio/packrat@2d9b533) 
 plotly      * 2.0.4       2015-11-30 Github (ropensci/plotly@e3ecaef) 
 plyr          1.8.3       2015-06-12 CRAN (R 3.2.0)                   
 R6            2.1.1       2015-08-19 CRAN (R 3.2.0)                   
 Rcpp          0.12.2      2015-11-15 CRAN (R 3.2.2)                   
 reshape2    * 1.4.1.9000  2015-11-30 Github (hadley/reshape@d38539d)  
 scales        0.3.0       2015-08-25 CRAN (R 3.2.0)                   
 shiny         0.12.2.9005 2015-11-17 Github (rstudio/shiny@119ebb0)   
 stringi       1.0-2       2015-11-30 Github (Rexamine/stringi@6d9ed3b)
 stringr       1.0.0.9000  2015-11-30 Github (hadley/stringr@a67f8f0)  
 viridis       0.3.1       2015-10-11 CRAN (R 3.2.0)                   
 xtable        1.8-0       2015-11-02 CRAN (R 3.2.0)                   
 yaml          2.1.13      2014-06-12 CRAN (R 3.2.0)            

@lgaliano
Copy link

Works for me as well, although it seems it is very dependent on the window size. Noticed similar behavior with labels in x/y axis labels overlapping the tick labels or disappearing from the screen. This is also seen in some cases on facet_wrap where the axis labels and the tick labels overlap or disappear from the screen. Same behavior is observed in facet_wrap with more than 1 row
Example 1: Window "properly" sized:
image
Example2: Short width: (wide window)
image
Example 3: Long height: (tall window)
image

Example 4: Overlaps with facet_wrap() with more than 1 row:
image

Code:

df <-iris %>% group_by(Species) %>% mutate(meanSep = mean(Sepal.Length))
ggplotly(ggplot(aes(x=Sepal.Length, fill="red"), data=df)+geom_density()+facet_wrap(~Species, scales="free"))

@cpsievert
Copy link
Collaborator

This should be fixed in f1900cc. Let us know if you still have problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants