Closed as duplicate of#6484
Description
library(ggplot2)
library(patchwork)
p1 <- ggplot(mtcars) +
geom_point(aes(mpg, disp)) +
ggtitle("Plot 1")
p3 <- ggplot(mtcars) +
geom_point(aes(hp, wt, colour = mpg)) +
ggtitle("Plot 3")
p <- patchwork::wrap_plots(
p1, p3 + scale_color_continuous(guide = guide_colorbar(
theme = theme(legend.key.height = unit(1, "null"))
)),
ncol = 1L,
guides = "collect"
)
print(p)
#> Error: Cannot create zero-length unit vector ("unit" subsetting)
Created on 2025-05-30 with reprex v2.1.0
~
~
Metadata
Metadata
Assignees
Labels
No labels