krassowski / complex-upset

A library for creating complex UpSet plots with ggplot2 geoms
MIT License
469 stars 28 forks source link

Error in plot_them(plot)! #201

Open katekt12 opened 7 months ago

katekt12 commented 7 months ago

Describe the bug Hey, I have used Upset Plot before and it produced exactly like in the documentation. But, I tried to do it again and it gave me this error. I tried updating my package (both ggplot and ComplexUpset) and it still does the same thing. Can you help to debug this? I don't know what happened. This is the error that I got:

< Error in plot_theme(): ! The legend.text.align theme element is not defined in the element hierarchy. Backtrace:

  1. base (local) <fn>(x)
  2. patchwork:::print.patchwork(x)
  3. patchwork:::build_patchwork(plot, plot$layout$guides %||% "auto")
  4. base::lapply(x$plots, plot_table, guides = guides)
  5. patchwork:::plot_table.ggplot(X[[i]], ...)
  6. ggplot2::ggplotGrob(x)
  7. ggplot2:::ggplot_gtable.ggplot_built(ggplot_build(x))
    1. ggplot2:::plot_theme(plot)>

Code to reproduce

movies = as.data.frame(ggplot2movies::movies)
head(movies, 3)

genres = colnames(movies)[18:24]
genres

movies[genres] = movies[genres] == 1
t(head(movies[genres], 3))

movies[movies$mpaa == '', 'mpaa'] = NA
movies = na.omit(movies)

upset(movies, genres, name='genre', width_ratio=0.1)

Expected behavior It should produce this plot similar like in the documentation.

image

Screenshots

image

Context (required)

ComplexUpset version: 1.3.3

R version details ```R ```
R session information ```R ```
dnyansagar commented 7 months ago

Hi I am also having this error. Here is the code I used to reproduce error ComplexUpset::upset( movies, c("Action", "Comedy", "Drama"), width_ratio=0.2, group_by='sets', queries=list( upset_query(group='Drama', color='maroon'), upset_query(group='Comedy', color='blue'), upset_query(group='Action', color='orange'), upset_query(set='Drama', fill='maroon'), upset_query(set='Comedy', fill='blue'), upset_query(set='Action', fill='orange') ) ) Is there any way to resolve this error

--Rohit

karajones commented 7 months ago

This behavior is explained in another issue: https://github.com/krassowski/complex-upset/issues/195 To fix, you need to uninstall the package using remove.packages("ComplexUpset") and reinstall with install.packages("ComplexUpset", type = "source"). That fixed it for me!

dnyansagar commented 7 months ago

Thanks Kara!