Open Yunuuuu opened 1 month ago
I want to push all these features to pachwork, since ggalign
focus on plot which need reorder the axis like dendrogram (we need reorder the data before using patchwork
to compose the plot). See the column names of the heatmap (they are reordered to match the dendrogram):
set.seed(123)
small_mat <- matrix(rnorm(81), nrow = 9)
rownames(small_mat) <- paste0("row", seq_len(nrow(small_mat)))
colnames(small_mat) <- paste0("column", seq_len(ncol(small_mat)))
ggheatmap(small_mat) +
hmanno("t") +
align_dendro(aes(color = branch), k = 3) +
geom_point(aes(color = branch, y = y))
This seems like a duplicate of #193 - I agree this would be useful
Thanks, that's what I wanted, I missed the issue.
I have modified the patchwork process to let user add their classes for alignment instead of using
is_valid_plot
: https://github.com/thomasp85/patchwork/blob/6d14415df326a545da4de6140f8433c679eac4fb/R/wrap_plots.R#L58What the developer should do is to add
alignpatch
method (If necessary, we can define the detail behaviour with a subclass ofPatch
which is aggproto
class): https://github.com/Yunuuuu/ggalign/blob/01f6063311313e5dff76e34ea77e92f5e2cffbb1/R/alignpatch-.R#L146Now, I have added methods for my own classes (two
Layout
) in ggalign, classes from ComplexHeatmap, andpatchwork
class.Created on 2024-09-14 with reprex v2.1.0 ~