Edits to the labels of the Y axis of the matrix plot are overridden
Opened this issue · 0 comments
MrHedmad commented
Describe the bug
When passing custom labels to the matrix, they are overridden by those automatically generated by upset_data
, effectively preventing the user to change the labels of the matrix plot.
Code to reproduce
# Load the example dataset as-is
# Install ggplot2, ComplexUpset and ggplot2movies
library(ggplot2)
library(ComplexUpset)
movies <- as.data.frame(ggplot2movies::movies)
genres <- colnames(movies)[18:24]
movies[genres] <- movies[genres] == 1
movies[movies$mpaa == '', 'mpaa'] <- NA
movies <- na.omit(movies)
# Plot without any modifications ("Plot 1")
upset(movies, genres, name='genre', width_ratio=0.1)
# Override the "labels" in the y axis of the matrix plot ("Plot 2"):
upset(
movies, genres, name='genre', width_ratio=0.1,
matrix = (
intersection_matrix() +
scale_y_discrete(
labels = tolower(genres)
)
)
)
# Other modifications work as expected (and documented, "Plot 3"):
upset(
movies, genres, name='genre', width_ratio=0.1,
matrix = (
intersection_matrix() +
scale_y_discrete(
labels = tolower(genres),
position = "right"
)
)
)
Expected behavior
I expect to be able to change the labels assigned to the matrix plot, overriding those provided by upset_data
. See the attached "Plot expected" image.
Screenshots
Context (required)
ComplexUpset version: 1.3.3
R version details
$platform
[1] "x86_64-pc-linux-gnu"
$arch
[1] "x86_64"
$os
[1] "linux-gnu"
$system
[1] "x86_64, linux-gnu"
$status
[1] ""
$major
[1] "4"
$minor
[1] "4.2"
$year
[1] "2024"
$month
[1] "10"
$day
[1] "31"
$`svn rev`
[1] "87279"
$language
[1] "R"
$version.string
[1] "R version 4.4.2 (2024-10-31)"
$nickname
[1] "Pile of Leaves"
R session information
R version 4.4.2 (2024-10-31)
Platform: x86_64-pc-linux-gnu
Running under: Arch Linux
Matrix products: default
BLAS: /usr/lib/libblas.so.3.12.0
LAPACK: /usr/lib/liblapack.so.3.12.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: Europe/Rome
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] patchwork_1.3.0 ComplexUpset_1.3.3 assertthat_0.2.1 archive_1.1.8
[5] lubridate_1.9.3 forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4
[9] purrr_1.0.2 readr_2.1.5 tidyr_1.3.1 tibble_3.2.1
[13] ggplot2_3.5.1 tidyverse_2.0.0
loaded via a namespace (and not attached):
[1] bit_4.0.5 gtable_0.3.5 crayon_1.5.3 compiler_4.4.2
[5] tidyselect_1.2.1 parallel_4.4.2 scales_1.3.0 R6_2.5.1
[9] labeling_0.4.3 generics_0.1.3 munsell_0.5.1 pillar_1.9.0
[13] tzdb_0.4.0 argparser_0.7.2 rlang_1.1.4 utf8_1.2.4
[17] stringi_1.8.4 pkgload_1.4.0 bit64_4.0.5 timechange_0.3.0
[21] cli_3.6.3 withr_3.0.1 magrittr_2.0.3 grid_4.4.2
[25] vroom_1.6.5 rstudioapi_0.16.0 ggplot2movies_0.0.1 hms_1.1.3
[29] lifecycle_1.0.4 vctrs_0.6.5 glue_1.7.0 farver_2.1.2
[33] fansi_1.0.6 colorspace_2.1-1 tools_4.4.2 pkgconfig_2.0.3