79796447

Date: 2025-10-22 06:33:26
Score: 1
Natty:
Report link

Simply remove the width setting, allowing patchwork to automatically determine the width and height.

library(ggplot2)
library(patchwork)

g1 <- ggplot() +
    geom_point(aes(x = sort(rnorm(100)), y = sort(rnorm(100)))) +
    geom_abline(slope = 1, linetype = "dashed") +
    coord_fixed()
g2 <- ggplot() +
    geom_point(aes(x = sort(rnorm(100)), y = 2 * sort(rnorm(100)))) +
    geom_abline(slope = 1, linetype = "dashed") +
    coord_fixed()
(g1 + g2)

enter image description here

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Yun