ITADN

`plot.tag` theme does not work for heatmaps

#75Closedgabrielnegreira 创建于 2025-08-14
bug
G
gabrielnegreiracommented
Hi, First thanks a lot for implementing the new `layout_tags` feature so fast! While using it, I noticed a small bug when theming the tags. In summary, `theme(plot.tag = element_text())` does not work with the heatmaps generated by `ggheatmap()`. Here is a reproducible code for this bug: ```r #load libraries library(ggplot2) library(ggalign) #make simple plots p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp)) p2 <- ggplot(mtcars) + geom_boxplot(aes(factor(gear), disp)) p3 <- ggplot(mtcars) + geom_bar(aes(factor(gear))) + facet_wrap(~cyl) #make a matrix for the heatmap mat <- matrix( rnorm(90, mean = 0, sd = 2), nrow = 9, ncol = 10, dimnames = list(paste0("G", 1:9), paste0("S", 1:10)) ) #plot the heatmap hm <- ggheatmap(mat) #combine the plots top <- align_plots(p1, p2, p3, nrow = 1) final <- align_plots(top, hm, ncol = 1) final <- final + layout_tags("A") & theme(plot.tag = element_text(size = 26, color = "red")) final ``` And here is the outcome: <img width="650" height="647" alt="Image" src="https://github.com/user-attachments/assets/32a724e9-be03-454e-9020-ef8ef3817e93" /> As you can see, the heatmap label does not get the red collor nor the bigger size.
关闭于 2025-08-14 3 条评论