njtierney / naniar

Tidy data structures, summaries, and visualisations for missing data
http://naniar.njtierney.com/
Other
652 stars 53 forks source link

Extra white space in gg_miss_upset() output in R notebooks #259

Open VectorPosse opened 4 years ago

VectorPosse commented 4 years ago

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](https://user-images.githubusercontent.com/7785887/85931266-4fa8ab00-b880-11ea-88ea-f560b39058a1.png)
njtierney commented 4 years ago

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?

VectorPosse commented 4 years ago

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.

njtierney commented 4 years ago

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 commented 4 years ago

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.

VectorPosse commented 4 years ago

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 notifications@github.com 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 .

andrader commented 3 years ago

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

njtierney commented 1 year ago

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