Skip to main content
Filter by
Sorted by
Tagged with
1 vote
2 answers
141 views

I am trying to compose a figure with multiple panels. I have a lot of empty space and I am trying to overlap some of the rectangular panels, so I can make some of them larger. However, setting in ...
dkysh's user avatar
  • 91
0 votes
1 answer
89 views

I'm trying to graph coefficients (points) and standard errors (error bars) for different metrics and different double machine learning algorithms, across 3 different examples (3 different plots). I've ...
Quinn's user avatar
  • 67
0 votes
2 answers
74 views

I'm trying to recreate a stunning and often shared graphic "Where are Americans Born." It involves using facet_geo to display the percent of out-of-state and foreign born residents for each ...
TCD's user avatar
  • 11
1 vote
1 answer
90 views

I have a simple plot and I want to collect the x and y axes together: library(ggplot2) library(patchwork) p1 <- ggplot(mtcars, aes(mpg, disp)) + geom_point() + labs(x = "mpg", y = &...
John-Henry's user avatar
  • 1,859
0 votes
2 answers
102 views

I have 3 plots that I want to arrange in a 2x2 format. They all share the same legend, and I want to place the legend in the bottom right space, where a fourth figure would fit. So far, I have tried ...
Gabriel's user avatar
  • 121
1 vote
2 answers
81 views

patchwork provides an option to use only one legend in case the legend is identical across different sub-panels. Changing the vertical spacing between legend items does not work as I would expect for ...
NicolasBourbaki's user avatar
-4 votes
1 answer
152 views

I would like to generate a few different plots in ggplot2 and assemble them in an image tool like MS publisher or Inkscape to get a single publication-ready figure. Ideally, I would like to produce ...
Cobalamin's user avatar
1 vote
1 answer
235 views

It seems to me that this was working before. I am using patchwork 1.3.0 , with ggplot2 3.5.2. Here is my problem: p1 <- ggplot(iris,aes(Sepal.Length,Sepal.Width,color = Species))+ geom_point() ...
denis's user avatar
  • 5,731
0 votes
2 answers
114 views

I'm visualizing ecological niche shifts by combining a scatter plot (scaled environmental values) with marginal density plots of the respective variables — similar to a marginal histogram layout. I am ...
Antony's user avatar
  • 1
2 votes
3 answers
117 views

I need to combine two ggplots. They should have labels (A, B, and C) as for being used in a publication. The first plot is a facet_wrap(). This is my code: library(ggplot2) library(dplyr) library(...
Giuseppe Petri's user avatar
1 vote
2 answers
111 views

I want to reproduce this graph: From the following paper: https://www.journals.uchicago.edu/doi/10.1086/730711 I have used facet wrap, but it does not have variable heights. Facet grid would not work ...
Victor Hartman's user avatar
0 votes
1 answer
80 views

This is a follow up to my earlier question, elegantly answered by the community. I am using the same dataset as in the earlier question, given below: topclones<- structure(list(CTaa_beta = c("...
Zoya Qaiyum's user avatar
1 vote
1 answer
73 views

I am trying to place the 5 graphs in a way that Three graphs comes on top row and 2 graphs in bottom row but the problem is the graphs at bottoms appear either on right or left side. I want to place ...
Muhammad Jawad's user avatar
1 vote
1 answer
117 views

I'm using the patchwork package in R to arrange 6 plots into a 3-row by 2-column layout, where each column has plots stacked vertically. Each vertical column works when created independently, with ...
Excelsior's user avatar
  • 287
6 votes
2 answers
299 views

When merging axis labels with the patchwork package, problems occurred (see this question). From the answer of the question, I applied the idea of the example code to my concrete example, in which I ...
Excelsior's user avatar
  • 287
1 vote
2 answers
145 views

I am creating a 2x2 matrix of raster plots using ggplot2 and patchwork, where each plot is generated from a different dataset. I want to ensure that the x- and y-axis of these plots, which are equal, ...
Excelsior's user avatar
  • 287
1 vote
1 answer
160 views

I am trying to combine three plots, and I would like to have one plot on top and two in a second row one next to the other. All plots should have same height and width. I am using patchwork package. ...
kris's user avatar
  • 187
0 votes
0 answers
100 views

I am trying to create a panel of scatterplots displaying different subsections of the same dataset. I want to combine all of their legends, but because of the subsetting, no individual plot contains ...
Chris Shipway's user avatar
1 vote
1 answer
92 views

In the most straightforward case, the patchwork does a good job of pairing its two panels, but it also seems to ignore the subdiagram's specification of the location of the legend legend.box.spacing: ...
Breeze's user avatar
  • 584
2 votes
1 answer
122 views

I am making a multi-panel figure in R using wrap_plots from the patchwork package, and I'd like to have the final plot show a common legend for point shape and color, but have each plot keep its own ...
millie0725's user avatar
1 vote
1 answer
57 views

I'm pretty new to R and so far have successfully managed to solve all issues I encountered using a combination of stackoverflow, manuals, Google and ChatGPT. So before I start I have to say a big ...
chodid's user avatar
  • 13
3 votes
0 answers
125 views

A situation was encountered when merging subgraphs in using patchwork. It is necessary to use inset_element to merge multiple times and then label at the end. But in the case of labeling the following ...
Breeze's user avatar
  • 584
1 vote
1 answer
43 views

Preamble I have 2 plots in ggplot2 and want to put them in RMarkdown document. I'm mainly using grid.arrange to do that. But since those plots have completely different heights, I need to adjust using ...
isaid-hi's user avatar
  • 173
3 votes
2 answers
63 views

This is similar to the question here, but I am interested in how to add and align a separate plot to a spare panel that may exists at the end of a facet_wrap() call. Currently I am thinking it might ...
Daniel Padfield's user avatar
2 votes
1 answer
156 views

I'm trying to combine several plots using patchwork in R, but I'm encountering an issue with misalignment and inconsistent spacing between the panels. The first set of plots is drawn with double ...
Yeahhiam's user avatar
0 votes
1 answer
100 views

With the code library(ggplot2) library(patchwork) dat.a <- data.frame(year=rep(2021:2024,times=2),group=rep(c("A","B"),each=4),val=runif(8,1,10)) dat.b <- data.frame(year=...
Antonio's user avatar
  • 783
1 vote
1 answer
151 views

I need to create a plot layout with two main plots having an inset each. I'd like to keep the legend in the main plots (positioned inside the plot), but I need to show the insets without any legend. I ...
Giuseppe Petri's user avatar
2 votes
1 answer
62 views

Based on what I read in this answer , what I am trying to do should work. However, the legend is missing. I want to add a legend in the center of a guide space of two plot spaces. library(ggplot2) ...
Giuseppe Petri's user avatar
1 vote
1 answer
64 views

I am attempting to place multiple graphs into one page using patchwork. I have the separate graphs as Group 1 and Group 2 with their 2 legends in each case. However, when I use patchwork to put them ...
Gabby's user avatar
  • 21
1 vote
2 answers
530 views

This is about organizing plots in R markdown document. Say we create three plots: library(patchwork) library(tidyverse) a <- ggplot(mtcars, aes(mpg, wt)) + geom_point() + ggtitle("Plot A"...
Gal Levin's user avatar
0 votes
0 answers
131 views

A new error message popped up with patchwork today in code that used to work. Here's a reproducible example: library(tidyverse) library(magrittr) library(patchwork) d1 <- tibble( x = rep(1, 5), ...
tomw's user avatar
  • 3,281
1 vote
1 answer
110 views

How do you work around space issues when the scales/legends do not fit vertically beside a plot? I would like to arrange them in a grid with n-rows and m-cols (similar to this question) and align each ...
Daniel Zuluaga's user avatar
1 vote
1 answer
470 views

I tried to create a plot with shared axis-labels. The problem was, that I wanted my legend under my plots, because my plots otherwise would be too compressed. I didn't managed to creade a good plot ...
W B's user avatar
  • 11
1 vote
1 answer
223 views

I am struggling to make a legend that I want for my graph. Here is what the graph currently looks like (it's not a final version, I know it's not super pretty) I am frustrated by the fact that I can'...
lmbradley's user avatar
  • 113
0 votes
1 answer
82 views

A simple patchwork of ggplot has left me uncertain how to locate the legend in the overall figure. Here's the data and the two plots library(tidyverse) library(patchwork) library(magrittr) set.seed(...
tomw's user avatar
  • 3,281
0 votes
1 answer
466 views

Using a combination of ggplot2, magick, and patchwork, I've gotten pretty close to getting a programmatic sediment core downhole log plot with a scaled photograph aligned along the left y-axis. See ...
Geoarch's user avatar
  • 55
2 votes
1 answer
279 views

I have two plots. The first one (big) is the one which should function as the "background plot". The second (small) should be the inset. How can i adjust the size of the inset? How to ...
geek45's user avatar
  • 723
1 vote
3 answers
385 views

I'd like to plot an inset map in the top left corner of another map using package patchwork. Yet, when using coord_sf(), the alignment does not work anymore. How to solve this to ensure the inset map ...
erc's user avatar
  • 10.2k
3 votes
1 answer
534 views

I have a grouped bar plot (two conditions with two groups in each). I am not having trouble creating the group bar plots, but I am interested in putting individual data points on the plot and ...
Ryan Panela's user avatar
1 vote
1 answer
150 views

I've been struggling to understand the patchwork package in R. The barchart on the right of the plot should be much thinner, like the one on top of the scatter plot. Below is my code. Any suggestions? ...
CAM_etal's user avatar
2 votes
1 answer
233 views

I am trying to only "collect" partial of legends with patchwork, below is a minimal example. library(patchwork) library(ggplot2) p1 <- ggplot(mtcars, aes(mpg, disp, color = factor(vs))) +...
yuw444's user avatar
  • 436
2 votes
2 answers
934 views

I'm looking to combine multiple graphs generated from different functions into a single display. Specifically, I want to only keep the legend of the first graph in the wrap. Here is a minimal version ...
NoNameBoyy's user avatar
2 votes
2 answers
105 views

In this example, I added a border to the three plots: library(ggplot2) library(patchwork) theme_border <- theme_gray() + theme(plot.background = element_rect(fill = NA, colour = 'black', ...
Tianjian Qin's user avatar
0 votes
1 answer
73 views

I am creating three seperate plots which I then combine using patchwork. The third plot that I make uses facet_grid in order to add a secondary x axis with the years showing. But I think this somehow ...
Lucat's user avatar
  • 1
1 vote
1 answer
375 views

I want to combine two charts prepared with Plotly and ggplot2 into one PDF. Below, you can see the code for the preparation of the charts: library(ggplot2) library(plotly) library(dplyr) library(...
silent_hunter's user avatar
1 vote
1 answer
81 views

library(tidyverse) library(scales) library(patchwork) df <- tibble( date = rep(seq(ymd("2024-01-01"), ymd("2024-12-01"), by = "month"), 2), var1 = c(seq(1e6, 2....
Carl's user avatar
  • 7,590
0 votes
1 answer
318 views

I am having difficulty aligning my grid figure correctly when I have removed the repeating tick labels on the y-axis while combining other facet wraps with different length tick labels in patchwork. I ...
maRvin's user avatar
  • 375
2 votes
1 answer
138 views

Similar questions have been asked here, here, and here. However, they don't exactly solve the issue Im having. Essentially, I am creating a package that has a function that creates a bar plot and then ...
Electrino's user avatar
  • 2,930
0 votes
1 answer
192 views

When trying to add two ggplot objects (plots) using + from patchwork, I get the error as shown below. What could be the issue? require(patchwork) ex.df <- data.table( x1 = rnorm(1000, 20, 50), ...
B.M Njuguna's user avatar
0 votes
0 answers
542 views

I would like to use patchwork to plot two graphs side by side. Unfortunately, it returns an error and I don't know why. Here is some reproducible code: --- title: "Test" format: html --- ```...
Quinten's user avatar
  • 42.8k

1
2 3 4 5