Search code examples
rggplot2syntax-error

ggplot2 : Can't add ` ` to a ggplot object


everyone I generated 2 ggplot figures and I would like now to add them into the same figure, to do that I simply add the +. So I have 2 plots : (1 ggtree and 1 heatmap)

and I'm trying to add them in the same plot with :

ggplot<- gg_tr + gg_heat + plot_annotation(tag_levels="A")

But then I get the following issue message:

Error : Can't add `gg_heat` to a ggplot object.
Run `rlang::last_error()` to see where the error occurred.

Solution

  • library(patchwork)
    gg_tr + gg_heat