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
0
votes
1 answer

How to remove majority of blank space from get_legend()?

I've been attempting to extract a ggplot2() legend with cowplot::get_legend() following the instructions outlined in a previous post. I aim to save this as an image to add to another plot and would like to change the background colour to "#F0F8FF"…
Ben_89
  • 249
  • 1
  • 8
0
votes
0 answers

ggplot2: Why are my axis labels and axis values disappearing when arranging in cowplot::plot_grid() in R

Issue: I have a list of histograms which I created using the function as.ggplot() from the ggplotify package and I assembled them into a grid of plots with the function cowplot::plot_grid(). My axis values and labels have disappeared and I was…
Alice Hobbs
  • 1,021
  • 1
  • 15
  • 31
0
votes
1 answer

Combining 3 barplots in a single column

I have generated 3 bar plots using barplot() function. Now I need to combine these 3 plots in a single column and get another new plot. I have used cowplot to do so however it showed warning message In as_grob.default(plot) :Cannot convert object…
doggyZ
  • 3
  • 3
0
votes
1 answer

ggplot cowplot ensuring y axes are identical when arranging plots with log scale

I want to create a combination plot using plot_grid from the cowplot package. The two plots that I want to combine use a log scale. Of the data plotted, some is negative, which gets dropped. I can quite easily produce a decent result using…
Moritz Schwarz
  • 2,019
  • 2
  • 15
  • 33
0
votes
0 answers

RColorBrewer: n too large

Any idea on how to avoid the below reproducible error please? df <- data.frame(x,x,x,x,x,x,x,x,y,y,y,y,y,y,y) data <- df %>% pivot_longer(all_of(setdiff(colnames(df),'x'))) plot_calc <- ggplot(data, aes(x=x))+ geom_bar(aes(fill=name, y=value,…
gaut
  • 5,771
  • 1
  • 14
  • 45
0
votes
1 answer

Properly size multiple ggExtraPlot objects after calling ggMarginal in R

I want to create a facet-like effect with ggExtra::ggMarginal plots. This is not yet directly possible, so I tried to use patchwork::wrap_plots, cowplot::plot_grid, and egg::ggarrange to do it myself. I have everything properly developed—except for…
Prayag Gordy
  • 667
  • 7
  • 18
0
votes
1 answer

Arranging multiple ggplots with fixed aspect Ratio

I have several Plots, all build out of facets of various numbers, but all with a fixed aspect ratio (See Picture). How can I combine all of them in one Plot, where the individual facets have the same size, while at the same time minimizing the…
kEks
  • 304
  • 1
  • 9
0
votes
0 answers

How to Modify ggplot() Plot Widths when Arranged using the plot_grid() function in the Cowplot Package

Issue: I am using the plot_grid() function of the cowplot package and I am creating a panel of ggplot() objects that has nine columns and three rows since I have produced 9 boxplots, 9 histograms, and 9 qqggplot() plots. As you can observe from the…
Alice Hobbs
  • 1,021
  • 1
  • 15
  • 31
0
votes
3 answers

arranging multiple plots with cowplot cuts off statistics

When arranging multiple plots from a plotlist with cowplot, the stat_compare_means values get cut off in the grid (see picture). When I am removing the plots titles it will still be cut off. Is there a way to fix this? Please find reproducible code…
immuen
  • 43
  • 4
0
votes
0 answers

Add geom_point() to cowplot subplot

I have made a cowplot using gg <- cowplot::plot_grid(p1, p2) I now want to add a ggplot2::geom_point() layer to p1 but I only have access to gg. How can I pull p1 and p2 back out, add a layer to p1 and then make a new cowplot,…
jtd
  • 179
  • 7
0
votes
1 answer

How to have a single grid background in "cowplot" using plot_grid() combining two plots together? in R language

In R language I want to have a single background horizontal lines (background grid) to make it easier to identify the columns. I will provide an example in the R code. # install.packages("cowplot") library(ggplot2) library(cowplot) df <-…
chaw r
  • 57
  • 5
0
votes
1 answer

Is there an option to ad a black border to a image nested in a ggdraw?

library(cowplot) ggdraw() + draw_plot(p) + draw_image(magick::image_read("img.png"), scale = .25, x = .4, y = .1) Here p is not even important, I would just like to add a black border to img.png.
GiulioGCantone
  • 195
  • 1
  • 10
0
votes
2 answers

How to sensibly align two legends when using cowplot in R?

A similar question was asked here, however I cant adapt the answer to my issue. I am trying to correctly align two legends when using cowplot. For example, if I create some data and a cowplot with two legends like…
Electrino
  • 2,636
  • 3
  • 18
  • 40
0
votes
1 answer

Can I prevent cowplot label positions from depending on their length?

I have four plots that I would like to label with the builtin cowplot labeler (in ggplot in r). My labels have very different lengths. I notice that when I plot these labels the position of the labels depend on the label length with longer labels…
ohnoplus
  • 1,205
  • 1
  • 17
  • 29
0
votes
1 answer

Fixing spacing issue with annotations in cowplot/patchwork

I'm trying to combine several figures drawn in PowerPoint into a panel, using patchwork, cowplot, magick. However, I always feel that the distance between the annotation and the actual figure is too big, and I'm struggling to find a way that…
Cmagelssen
  • 620
  • 5
  • 21