const-ae/ggupset

Remove Panel Border/Background

jeffkimbrel opened this issue · 2 comments

Hello,

I can't figure out how to modify the theming to remove the white border on top and below of the ggupset panel. This is really only apparent when theming the whole plot to be a dark theme (see image where I modified the strip.background.colors). Any theming I do doesn't seem to touch the ggupset panel, although it does the geom_bar().

  ggupset::scale_x_upset() +
  ggupset::theme_combmatrix(combmatrix.panel.striped_background.color.one = "gray20",
                            combmatrix.panel.striped_background.color.two = "gray30")

image

Looking at the ggplot object $theme doesn't give any hints as well...

$ combmatrix.label.make_space                  : logi TRUE
 $ combmatrix.label.extra_spacing               : num 3
 $ combmatrix.label.total_extra_spacing         : 'simpleUnit' num 10points
  ..- attr(*, "unit")= int 8
 $ combmatrix.panel.margin                      : 'simpleUnit' num [1:2] 1.5points 1.5points
  ..- attr(*, "unit")= int 8
 $ combmatrix.panel.striped_background          : logi TRUE
 $ combmatrix.panel.striped_background.color.one: chr "gray20"
  [list output truncated]
 - attr(*, "class")= chr [1:2] "theme" "gg"
 - attr(*, "complete")= logi TRUE
 - attr(*, "validate")= logi FALSE

Can you point me to where in the code this white box/border may be coming from?

Thanks,

Jeff

Hi Jeff,

thanks for reaching out.

I can't figure out how to modify the theming to remove the white border on top and below of the ggupset panel

The problem is probably that I have not considered dark themes when developing the package. I set the theme for the combination matrix here. And if I had to guess where the problem is coming from, it's because I don't fix the expand argument of scale_y_discrete() and some background of the plot remains visible. One solution would be to add another theme element that fixes the issue or see if setting expand = c(0, 0) in scale_y_discrete() is in general the better idea (not just for dark themes). Would you be interested in drafting a PR?

Best,
Constantin

So, expand = c(0,0) didn't work, because it is based on the center of the circles, and brought those to be 50% inside and 50% outside the panel...

image

I saved a plot to pdf, and opened in affinity and noticed the white section was a filled rectangle, not a border. So, theming to force rectangles to be transparent got me 90% there...

image

And then a little more to remove the white grid lines peaking out above and below, and it looks good.

image

Changing just the panel background theme means the panel doesn't change size at all, so old plots look identical to new plots.

PR on the way... #23