Question Details

No question body available.

Tags

r ggplot2 export patchwork

Answers (1)

Accepted Answer Available
Accepted Answer
January 6, 2026 Score: 1 Rep: 70,345 Quality: High Completeness: 80%
ggsave("myplot.png", finalplot, width = 180, height = 170, units = "mm")

Should suffice. Note, the directions are to make an output that is 180x170 mm, which is about 7.087 inches x 6.69 inches, which at 300 dpi would be a resolution of about 2,125 x 2,007 pixels, which is what the code above generates for me.

(Your question seems to misread the dimensions as being in pt, which would be very small -- then your total figures would be 2.5 inches wide and each subplot less than 1/2 inch wide.)

I am not entirely sure how to confirm the pt size of the text, but I will note that the text looks the same size in the output for plots[1] as for finalplot, so it appears that patchwork is making the appropriate adjustments -- ie the charts are shrunk but the x axis labels do not appear to be.

As I noted in a comment, https://www.christophenicault.com/post/understandsizedimensionggplot2/ is worth a read to help understand how dimensions, resolution, and text size interact in ggplot2 figures.