plotly / plotly/plotly.R

facet_wrap: middle row plotted differently from top and bottom facet rows

Open
#2,167 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

You can see from the attached plot that the middle row of faceted plot is missing the "H" values (y-axis), since the facet labels for the bottom row are covering those "H" values (Note: I'm not showing all of the data in the plot; just what is relevant).

Screen Shot 2022-08-14 at 5 24 44 PM

I cannot provide a full reprex, since the data is private, but my code for that chunk (quarto doc; Rstudio 2022.07.1):

p = annot %>%
  mutate.(`plate row` = `plate row` %>% 
            reorder(`plate row` %>% as.factor %>% as.numeric %>% rev)) %>%
  ggplot(aes(`plate column`, `plate row`, 
             text=`Species name`,
             color=`Strain Viability`, size=`Strain Viability`)) +
  geom_point() +
  scale_x_continuous(breaks=1:12) +
  scale_color_continuous(low='black', high='orange') +
  scale_size_continuous(range = c(1,2)) +
  facet_wrap(~ plate)
ggplotly(p, tooltip='text') %>% 
  layout(autosize = F, width = 800, height = 400)

sessionInfo:

R version 4.2.1 (2022-06-23)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.4

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

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 datasets  utils     methods   base     

other attached packages:
[1] gtsummary_1.6.1   skimr_2.1.4       plotly_4.10.0     tidytable_0.8.0  
[5] data.table_1.14.2 ggplot2_3.3.6     dplyr_1.0.9      

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.2    xfun_0.32           repr_1.1.4         
 [4] purrr_0.3.4         splines_4.2.1       lattice_0.20-45    
 [7] colorspace_2.0-3    vctrs_0.4.1         generics_0.1.3     
[10] htmltools_0.5.3     viridisLite_0.4.0   yaml_2.3.5         
[13] mgcv_1.8-40         base64enc_0.1-3     utf8_1.2.2         
[16] rlang_1.0.4         pillar_1.8.0        glue_1.6.2         
[19] withr_2.5.0         lifecycle_1.0.1     stringr_1.4.0      
[22] commonmark_1.8.0    munsell_0.5.0       gtable_0.3.0       
[25] htmlwidgets_1.5.4   forcats_0.5.1       labeling_0.4.2     
[28] knitr_1.39          fastmap_1.1.0       crosstalk_1.2.0    
[31] fansi_1.0.3         backports_1.4.1     checkmate_2.1.0    
[34] renv_0.15.5         scales_1.2.0        jsonlite_1.8.0     
[37] farver_2.1.1        digest_0.6.29       stringi_1.7.8      
[40] grid_4.2.1          cli_3.3.0           tools_4.2.1        
[43] sass_0.4.2          magrittr_2.0.3      lazyeval_0.2.2     
[46] tibble_3.1.8        crayon_1.5.1        tidyr_1.2.0        
[49] pkgconfig_2.0.3     ellipsis_0.3.2      broom.helpers_1.8.0
[52] Matrix_1.4-1        gt_0.6.0            httr_1.4.3         
[55] R6_2.5.1            nlme_3.1-157        compiler_4.2.1     

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied ggplotly(facet_wrap(...)) example and inspect how facet rows and y-axis labels are rendered. Reproduce the overlap with a minimal public dataset; done when middle-row “H” values remain visible without being covered by bottom-row facet labels.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.