Questions tagged [patchwork]

patchwork is an R package by Thomas Lin Pedersen providing a simple API for composing multiple plots from the ggplot2 package system.

Filter by
Sorted by
Tagged with
0
votes
0answers
8 views

Size of figures in knitr with patchwork or cowplot

I have a large number of figures which I would like to present in a single column in a document created with knitr. The number of figures can vary, so I created a function to combine all figures using ...
2
votes
1answer
35 views

Combine and merge legends in ggplot2 with patchwork (discrete/categorical data)

I arranged 3 ggplot2 plots into a single figure by using the functionality of package patchwork. I tried to collect the legends and they appeared one next to the other. But still, they are 3 separate ...
0
votes
0answers
28 views

Increase height of plots using patchwork::wrap_plots()

I am using patchwork::wrap_plots() to output a list of ggplots. Since that list is dynamic and does not always hold the same number of plots, I need to find a way to adjust the height of the plots so ...
0
votes
0answers
41 views

combine multiple plots and make same width in r with ggplot

Just as the title, I want to combine two combined plot but when I export the final plot it has different width. What I need is to make every single plot have the same width. To clearly the question I ...
1
vote
0answers
43 views

How to get rid of extra space at top of plot using ggplot2

I am using patchwork to combine two plots. Without limiting the y axis of the elevation plot, the scatter plot looks too steep for what I am trying to show (land elevation) but when I limit the axis I ...
0
votes
1answer
34 views

How to adjust the font style of tags with plot_annotation in figures assembled with patchwork?

I have a figure assembled with patchwork as follows: library(ggplot2) library(patchwork) p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp)) p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, ...
0
votes
1answer
87 views

Legend title position using patchwork?

I've laid out 2 graphs using patchwork, and have a legend which describes them both at the bottom. The legend has a horizontal orientation, and I'm trying to move the title to the top, rather than its ...
0
votes
1answer
129 views

Ignore x-label alignment with multiple plots in patchwork: is this possible?

I really like the patchwork package, alignment of multiple plots is often better and easier to realize than in other packages (cowplot/gridextra). However, one thing I cannot solve: Is it possible ...
1
vote
1answer
41 views

Show plot according to argument with patchwork package

I'm trying to write a function with patchwork package in which plots are displayed according to the arguments passed in the function. I tried the approach below, setting objects not passed in the ...
2
votes
0answers
29 views

Making patchwork compatible with pdf creator using downloadHandler in Shiny?

I'm interested in using the patchwork package in arranging a set of plots, which the end user can then download using a download button. For simplicity I've only shown one plot in this example. ...
2
votes
2answers
56 views

Create line across multiple plots in ggplot2

I want to create a horizontal line going across two plots combined with the patchwork package. library(ggplot2) library(patchwork) # Annotation after plot p1 <- ggplot(mtcars, aes(x=disp,y=mpg))+...
0
votes
1answer
106 views

How do I overlap figure axes and extend one axes title across two axes in ggplot?

I have a figure that includes four plots. All y-axis are Temperature and the two x-axis are Time1 and Time2. I am stacking and aligning all four plots into a 2x2 figure using the patchwork package and ...
2
votes
2answers
41 views

Align plots of different widths on x-axis scale values [duplicate]

How to align two plots with different widths so that: their x-axes are in sync the top row also contains a common legend I basically want each x-axis-interval to correspond to the same amount of ...
1
vote
2answers
132 views

Adding a grob to patchwork plot R

I have a function that returns a patchwork plot and I can't make any changes to. I would like to add a rectGrob() on top of it. When I try to do this I remove two of the plots. library(gridExtra) ...
6
votes
1answer
116 views

Colour in title of patchwork of ggplots using ggtext?

How can a patchwork of ggplots be given a colourful title using ggtext? Example Suppose we have four plots library(ggplot2) library(patchwork) library(ggtext) p1 <- ggplot(mtcars) + ...

15 30 50 per page