naniar icon indicating copy to clipboard operation
naniar copied to clipboard

Extra white space in gg_miss_upset() output in R notebooks

Open VectorPosse opened this issue 4 years ago • 7 comments

When running gg_miss_upset() in an R notebook in RStudio, there is an extra box of output that consists of nothing but white space. In the corresponding HTML file, there is an appreciable length of vertical white space appearing between the code chunk and the upset plot.

Reprex:

---
title: "gg_miss_upset bug"
output: html_notebook
---

```{r}
library(naniar)
data(airquality)
gg_miss_upset(airquality)
```

Version info:

R 4.0.2:

platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          4                           
minor          0.2                         
year           2020                        
month          06                          
day            22                          
svn rev        78730                       
language       R                           
version.string R version 4.0.2 (2020-06-22)
nickname       Taking Off Again        

RStudio 1.3.959

$mode
[1] "desktop"

$version
[1] ‘1.3.959’

$release_name
[1] "Middlemist Red"

Screenshot:

upset_plot_issue

VectorPosse avatar Jun 27 '20 20:06 VectorPosse

Hi there,

I'm not sure why this is the case - under the hood this calls the UpSetR package, which appears to not be well maintained at the moment, so I may need to look into changing the implementation.

Does this produce problems when rendering to HTML/PDF/Word?

njtierney avatar Aug 17 '20 01:08 njtierney

So it may be an R notebook issue. When I preview to HTML (creating a .nb.html file), the space appears. But knitting to HTML does not cause a space. Neither is there a space after knitting to PDF or Word.

VectorPosse avatar Aug 17 '20 04:08 VectorPosse

OK that's good to know, bit frustrating about the empty space in the .nb.html file though. Is it only the upset plot that creates the extra space in the .nb.html files, or is it in other types of plot output as well?

njtierney avatar Aug 17 '20 11:08 njtierney

If it's just the upset plot, I'll see if I can take a closer look at what the notebooks are doing and how the upset plot is generated.

njtierney avatar Aug 17 '20 12:08 njtierney

I haven't tried every single plot type, but all the ones I have tried seem to work okay (no extra whitespace) except the upset plot.

On Mon, Aug 17, 2020 at 6:00 AM Nicholas Tierney [email protected] wrote:

If it's just the upset plot, I'll see if I can take a closer look at what the notebooks are doing and how the upset plot is generated.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/njtierney/naniar/issues/259#issuecomment-674839508, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3M3H26X4FKOUS66BOPW6LSBELXVANCNFSM4OKFXFVA .

VectorPosse avatar Aug 17 '20 16:08 VectorPosse

I have the exact same problem. Did you manage to find a solution?

andrader avatar May 23 '21 17:05 andrader

It seems that this is an issue with UpSetR - the best solution I can think of to resolve this is

  1. Use an alternative upset plot or
  2. Write my own

I'm a bit busy with doing a bunch of small maintenance fixes at the moment so I might consolidate some of the issues with UpSetR and leave it as it is for the time being

njtierney avatar Apr 10 '23 07:04 njtierney