Questions tagged [cowplot]

The cowplot package is a simple add-on to ggplot2. It is meant to provide a theme for ggplot2 that is especially useful for formatting plots for publication in academic journals, and it also provides tools to neatly arrange multiple plots of different types, while minimizing the amount of required fiddling with sizes of axis labels, plot backgrounds, etc.

Cowplot

The cowplot package is a simple add-on to ggplot2. It is meant to provide a theme for ggplot2 that is especially useful for formatting plots for publication in academic journals, and it also provides tools to neatly arrange multiple plots of different types. while minimizing the amount of required fiddling with sizes of axis labels, plot backgrounds, etc.

Official CRAN Documentation

https://cran.r-project.org/web/packages/cowplot/index.html

CRAN Resources

284 questions
1
vote
0 answers

How to add a frame in a ggplot under cowplot library?

recently I started to use cowplot library. I'm a huge fan of the plot frames, however it seems that cowplot doesn't allow it. Anyone knows a trick to create a frame in plots with cowplot? library(ggplot2) library(cowplot) A <- c(rep(1, times = 3),…
Daniel Valencia C.
  • 2,159
  • 2
  • 19
  • 38
1
vote
0 answers

Blank plot when using cowplot with RNotebook

Say I have the RNotebook below. --- title: "R Notebook" output: html_notebook --- ```{r} library(cowplot) library(ggplot2) g <- ggplot(mtcars) + geom_point(aes(mpg, hp)) plot_grid(g,g) ``` When I run this I get a blank plot and then the actual…
Dan
  • 11,370
  • 4
  • 43
  • 68
1
vote
1 answer

R 'cowplot' neatly produce gridded plot with shared (common) legends and unique legends

See my related question and the accepted answer here. I am trying to produce a plot similar to that in the accepted answer i.e. a gridded plot with a shared common legend and a different unique legend attached to each plot on the grid.…
Tom Newton
  • 199
  • 2
  • 14
1
vote
2 answers

grid.text in a ggplot give an error in plot_grid

I am trying to use the plot_grid function from cowplot R package to put two plots together. However, I was getting the below error: Error in switch(x[[2]][[1]]$name, C_abline = C_abline(x[[2]]), C_plot_new = C_plot_new(x[[2]]), : EXPR must be…
user3091668
  • 2,230
  • 6
  • 25
  • 42
1
vote
2 answers

Add additional x-axis labels to a ggplot2 plot (with discrete axis labels) using cowplot

I am trying to add additional x-axis labels to a ggplot2 plot with discrete axis labels. I have tried a few approaches (including some that use grid, i.e. here), but have settled on using the add_sub() function from the cowplot package. However, it…
Joshua Rosenberg
  • 4,014
  • 9
  • 34
  • 73
1
vote
2 answers

How to use with plot_grid from cowplot

I want to combine several ggplot2 charts into one using cowplot::plot_grid(). From its documentation: ?plot Arguments ... List of plots to be arranged into the grid. The plots can be objects of one of the following classes: ggplot, recordedplot,…
iatowks
  • 970
  • 2
  • 9
  • 21
1
vote
1 answer

Assigning colours in stacked barplot

I created stacked plot of species abundance over time in three different sites. The code I created plots different species in different colours depending on their order of abundance in the different sites. How can I adapt the code to assign the…
Birdonawire
  • 199
  • 3
  • 10
1
vote
1 answer

Align multiple plots with unequal labels

I have a series of line plots, made with ggplot2. I want to arrange them in one plot, and I can do this with plot_grid from the cowplot package. However, because the labels (Universität vs. SP) are unequal in length, the plots are not aligned…
Mario
  • 2,393
  • 2
  • 17
  • 37
1
vote
0 answers

Remove y axis of one plot in a multipanel "cowplot" graph but keep the plots the same size

I have plotted two plots with the same y-axis scale side-by-side, and aligned them using cowplot. I'd like to remove the y axis of the right-hand side plot but when I do this, this plot becomes wider than the left one (I would like the plots to be…
LauRa28
  • 33
  • 3
1
vote
1 answer

R: Remove border when plotting with ggplot2 + ggExtra + cowplot

I couldn't find the way not to plot the outer frame when combining graphs through ggplot2 + ggExtra + cowplot. I am not sure where I have to tell R, but suspect the issue to lie in ggExtra. Here is an…
Ervan
  • 174
  • 12
1
vote
1 answer

cowplot plot_grid function to plot table as image and dendrogram

I am trying to use the plot_grid function from cowplot to make a customized plot with a dendrogram on the top row and two tables(next to each other)on the second row. Now what ends up happening is my dendrogram and tables get plotted, but on two…
Mdhale
  • 815
  • 2
  • 15
  • 22
1
vote
2 answers

Using a for loop to save multiple ggplot as jpeg

I'd like to save multiple ggplots as jpegs through a for loop. But when I've tried to adapt code I've written for a basic plot command, I get no output (nothing is saved to my working directory). For Example, this works…
Vinterwoo
  • 3,843
  • 6
  • 36
  • 55
1
vote
2 answers

Is it possible to suppress label cowplot package R

I was wondering if it is possible to suppress the axis label at (x - top: "mpg") and (y - right: "wt") using the package cowplot. library(ggplot2); library(cowplot) plot_a <- ggplot(mtcars, aes(mpg,wt)) + geom_point() …
unmark1
  • 322
  • 3
  • 13
1
vote
1 answer

Specify plot height in plot_grid with 'hv' aligment: cowplot

I have been using the plot_grid command from cowplot to arrange my plots. I use the labeling feature, and my plots all look the same in that regard. However, when I 'hv' align some plots that have very different y-axis limits, such as the one below,…
nofunsally
  • 2,051
  • 6
  • 35
  • 53
0
votes
0 answers

How to prevent grid.arrange() truncating plots captued with recordPlot()

Here is a simplified MWE of my issue. How can I edit the grids or the grid.arrange parameters so that both panels show without truncation?. library(cowplot) plot(1:5, 1:5) p1 <- recordPlot() plot(1:10, 1:10) p2 <-…
bioSlayer
  • 85
  • 5