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

plot_clone error in cowplot

I am trying to use plot_grid in package cowplot to make a 2x2 plot. I keep getting the error message: Error in plot_clone(plot) : attempt to apply non-function And I can't figure out how to correct this. At first I wasn't sure if cowplot could…
Maalthou
  • 29
  • 7
2
votes
1 answer

How to set the outer margins in ggplot2?

In R basic plot, the outer margins can be controlled through oma(), and I wonder if there is a similar function in ggplot2 to do this. As the following figure shows, the is almost no space between and figure and the edge of the page. Thanks a lot.…
Yang Yang
  • 858
  • 3
  • 26
  • 49
2
votes
1 answer

How to make box plots within the same column to represent the soil column

I am trying to demonstrate the soil type (soil column) at different depths in the ground using box plots. However, as the sampling interval is not consistent, there are also gaps in between the samples. My questions are as follows: Is it possible…
Rupesh
  • 41
  • 8
2
votes
1 answer

extrafont and showtext: arial not possible for eps figure

I have the same question as Error using Arial in .eps figure with extrafont package but the answers did not help me: I'm using ggplot2 and cowplot for creating figures. The journal, I want to publish in, wants an eps-file with arial as font. I used…
Z.Kipp
  • 63
  • 2
  • 9
2
votes
3 answers

How do I customize the margin and label settings with plot_grid?

I would like to have the title not be chopped off and have the axis labels removed from this chart that I generated with plot_grid from cowplot. Here is my code data(mtcars) library(ggplot2) library(cowplot) mpg = ggplot() + …
FTF
  • 181
  • 3
  • 11
1
vote
1 answer

Align ridgeplots

I have created two separate ridgeplots in R using the ggridge package and the stat_density_ridges() function. My dataset includes a series of Latitude and Longitude locations. I have produced one ridgeplot for Latitute and one for Longitude and they…
1
vote
1 answer

Fixing position of legend

Here is my data and corresponding ggplot library(ggplot2) library(ggnewscale) library(cowplot) library(ggalluvial) library(patchwork) data = structure(list(grp1 = c("X", "X", "X", "X", "Y", "Y", "Y", "Y" ), grp2 = c("A", "B", "C", "D", "A", "B",…
Bogaso
  • 2,838
  • 3
  • 24
  • 54
1
vote
1 answer

Using grid.arrange with a list and extra arguments

It's the same question than this one : How do I arrange a variable list of plots using grid.arrange?, but with extra arguments, for example a legend. Here is a toy example. Here is the data: Country = c("France", "Italy", "Peru", "Canada",…
armandfavrot
  • 169
  • 9
1
vote
2 answers

Converting a hist() and boxplot() object into a ggplot() object to align my plots using plot_grid() in the Cowplot Package in R

I am checking my data for normality and I have created boxplots - boxplot(), histograms - hist(), and ggqqplots() (using the ggpubr package, which is aligned with ggplot). The data shows measurements of acoustic parameters within spectrograms using…
Alice Hobbs
  • 1,021
  • 1
  • 15
  • 31
1
vote
2 answers

Plot original value, mom and yoy change for time series data in 3 subplots using ggplot2

Given two monthly time series data sample from this link. I will need to create one plot containing 3 subplots: plot1 for the original values, plot2 for month over month changes, and plot3 for year over year changes. I'm able to draw the plot with…
ah bon
  • 9,293
  • 12
  • 65
  • 148
1
vote
1 answer

Add families annotation to ggtree next to geom_bar in r

I would need help in order to add information within a plot. Here is the plot : (Code to get this plot below) And I would like to add a new element with families information stored in this tab: labels family 1 t2 Hominidae 2 t4 …
chippycentra
  • 3,396
  • 1
  • 6
  • 24
1
vote
1 answer

How to remove white spcaes around a bottom-aligned legend with cowplot

I am using cowplot to arrange two plots with a common legend below. The approach works, yet the legend has whitespace around I would like to get rid of. Note: I am ware of the ggpubr::ggarange common.legend option I though want to stick to…
ChriiSchee
  • 667
  • 1
  • 8
  • 20
1
vote
1 answer

Align another object with scatterplot+marginal boxplots

I've generated a scatterplot with marginal histograms on the x and y axes, using this extremely helpful answer from @ClausWilke (reproduced below). library(cowplot) # Main plot pmain <- ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, color =…
Timmo83
  • 119
  • 5
1
vote
1 answer

Plot alignment does not work for height and width simultaneously in plot_grid

Following codes generate a grid of plots shown in the figure below: library(tidyverse) library(cowplot) p1 <- cars %>% ggplot(aes(x = speed, y = dist)) + geom_point() + theme_bw() p2 <- cars %>% ggplot(aes(x = speed, y = dist)) + …
gokhale
  • 41
  • 3
1
vote
0 answers

Using a ggplot raster basemap with draw_plot and ggdraw seems to result in a blurred pdf

I need to produce a high resolution (1200dpi) image for a journal. However, using cowplot::draw_plot to overlay some insets seems to lower the resolution of the basemap (see resolution of "basemap_test.pdf" vs "cowplot_test.pdf"). There is a similar…
sebdunnett
  • 21
  • 2