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
2
votes
2 answers

How to get cowplot minor grid lines to be the standard ggplot default soft grey, not solid black

library(tidyverse) library(cowplot) p1 <- ggplot(mtcars, aes(factor(cyl))) + geom_bar(fill = "#56B4E9", alpha = 0.8) + scale_y_continuous(expand = expansion(mult = c(0, 0.05))) + theme_minimal_hgrid() p1 Cowplot v1.0.0 seems to work fine.…
Display name
  • 4,153
  • 5
  • 27
  • 75
2
votes
1 answer

Cowplot Package: Aligning text labels in the top lefthand corner of plot space using plot_grid() in R

Overview: I have produced a series of maps (see below) using the R-code below, and I used plot_grid() in the Cowplot package to arrange the plots using the two data frames below called "QuercusRobur 1" and "QuercusRobur2". Problem: The plots look…
Alice Hobbs
  • 1,021
  • 1
  • 15
  • 31
2
votes
1 answer

Cowplot Package: How to align legends vertically downwards after arranging many plots into one plot using plot_grid() in R

Overview: I have produced a series of maps using the R-code below, and I used plot_grid() in the Cowplot package to arrange the plots onto one plot window using the data frames below called "QuercusRobur1" and "QuercusRobur2". The plots look…
Alice Hobbs
  • 1,021
  • 1
  • 15
  • 31
2
votes
1 answer

Insert Image/PNG ggplot2 - Cowplot

I'm trying to use cowplot package's draw_image() function. I've managed to get an image in a graph as an example. I can't work out how the xy locations work, I had to keep inputting random numbers until I got to see the image. require(ggplot2)…
Dasr
  • 777
  • 6
  • 16
2
votes
2 answers

Altering ggplot2 plot using ggplot_build and use it in plot_grid

I want to alter a ggplot2 plot in R using the ggplot_build and ggplot_gtable functions and use it afterwards in a plot_grid. Example code to make the plot: library(ggplot2) library(cowplot) p1 <- ggplot(iris) + aes(x = Sepal.Length, y =…
pjvdam88
  • 21
  • 1
  • 4
2
votes
1 answer

Align plots with Cowplot in a grid in R

I have a question concerning plot alignment in Cowplot. I would like to align plots (ggplot) in a panel consisting of 3 columns. The first column has 2 plots (vertical aligned), the second column 1 plot, and the third also two plots (vertical…
user213544
  • 2,046
  • 3
  • 22
  • 52
2
votes
0 answers

cowplot: extracting subplot after calling plot_grid

I am using plot_grid to arrange two plots: library(ggplot2) library(cowplot) d = data.frame(x=rnorm(100), y=rnorm(100), g=sample(c('a', 'b'), 100, replace=T)) p1 = ggplot(d) + geom_point(aes(x=x, y=y, colour=g)) p2 = ggplot(d) + geom_point(aes(x=y,…
adn bps
  • 599
  • 4
  • 16
2
votes
2 answers

Can ggplot legends be moved freely outside the plot?

I have this issue that a plot drawn with cowplot:::plot_grid cuts the legend of the left-hand plot just by a few mm's. Legend size is already at the absolute minimum of readability, and the white space between the two plots is OK (so its not margins…
nouse
  • 3,315
  • 2
  • 29
  • 56
2
votes
1 answer

Adjusted labels hidden for nested plots

How do I make adjusted labels in nested plot_grid plots not hide below other plots? This works fine: # label 'b' is visible on top of figure a plot_grid(ggdraw(), ggdraw(), nrow=2, labels=c("a", "b"), hjust=c(-0.5, -5), vjust=c(1,-2)) But not…
user7727736
  • 97
  • 1
  • 8
2
votes
1 answer

Add a common legend

I was trying to do a multiplot with ggplot2. This was my initial code nucmer_s1 <- ggarrange(eight_uniform, ten_uniform, twelve_uniform, fourteen_uniform, sixteen_uniform, ncol=3, nrow=2, common.legend = TRUE,…
Bertha
  • 55
  • 1
  • 6
2
votes
1 answer

combining purrr and cowplot to make a plot grid

I have created a list column of ggplot2 figures using purrr and now I would like to use cowplot::plot_grid() to combine them into a single plot. How can I do this? There is a brute force way to do this, but that may not work when I don't a priori…
Indrajeet Patil
  • 4,673
  • 2
  • 20
  • 51
2
votes
0 answers

cowplot masking ggplot2 even after detaching

I'm having a problem with cowplot as I created several graphs using ggplot but as soon as I load cowplot I can no longer obtain the same plot rerunning that ggplot script. I detached cowplot using detach(package:cowplot) and when I search for it…
TheSciGuy
  • 1,154
  • 11
  • 22
2
votes
1 answer

Format ggplot font sizes for printing on paper

My goal is to generate plot in R so that it would print nicely on letter paper. Below is my example: library(cowplot) sample_df <- data.frame(col_1=c(1,2,3), col_2=c(6,7,8)) plot_1 <-ggplot(data=sample_df, aes(x = col_1, y =col_2, group=1))+ …
user1700890
  • 7,144
  • 18
  • 87
  • 183
2
votes
1 answer

Plot legend in an empty panel with cowplot/ggplot2

I have a panel with 5 plots and one shared legend, which i would like to arrange in a (2 rows, 3 columns)-grid. The bottom right panel should be used for the legend. library(ggplot2) library(cowplot) df <-data.frame(a=seq(1,20),b=seq(1,20),…
nouse
  • 3,315
  • 2
  • 29
  • 56
2
votes
0 answers

Customizing Gviz's plotTracks function

I'm trying to generate a track plot using Gviz's plotTracks function. For example, I'm trying to plot these three transcripts from gencode.v25.primary_assembly.annotation.gtf: "ENST00000352151.9","ENST00000550488.5","ENST00000335154.9" (all from…
dan
  • 6,048
  • 10
  • 57
  • 125