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 create a graph using cowplot without activating a blank window

Here is a reprex: require(cowplot) plot.mpg <- ggplot(mpg, aes(x = cty, y = hwy, colour = factor(cyl))) + geom_point(size=2.5) plot.diamonds <- ggplot(diamonds, aes(clarity, fill = cut)) + geom_bar()+theme(axis.text.x = element_text(angle=70,…
user2338823
  • 501
  • 1
  • 3
  • 16
0
votes
1 answer

Cowplot: How to add tick marks and corresponding data labels to a marginal plot?

R Packages: cowplot / ggplot2 Use Case: Scatter plot with marginal histograms. Issue: For histograms, I can't add bin sizes or reference lower/ upper class intervals in the x-axis. Without these histograms are difficult to read. In cowplot, is…
Vikrant
  • 125
  • 8
0
votes
1 answer

Alter default settings for cowplot theme

I like the default theme for cowplot, but I want to make some alterations. For example, I'd like to be able to adjust the default for legend.key. A MWE, library(ggplot2); library(cowplot) plt = ggplot(mtcars, aes(x = mpg, y = wt, color =…
user13317
  • 451
  • 3
  • 13
0
votes
1 answer

Use variables supplied to aes_string() in other ggplot functions

I'm using aes_string() in a function to create some graphs. I'm using cowplot for theming and this scales the axes to the maximum values of the data provided, cutting off the top or side of the points at the maximum as in the example below. I…
r.bot
  • 5,309
  • 1
  • 34
  • 45
0
votes
1 answer

Issues with ggdraw since ggplot2 update

I made a figure with the following code, however, I recently noticed some of my data points did not contain error bars as they should, so I am revisiting this code a few months after writing it. In this time there has been an update to ggplot2 and…
SoCo
  • 19
  • 3
0
votes
1 answer

gridGraphics::grid.echo error: EXPR must be a length 1 vector

I'm trying to use gridGraphics::grid.echo according to this link so I can combine a Gviz plotTracks plot with a ggplot using cowplot's plot_grid. Following Gviz's vignette and this link, here's what I do: require(Gviz) data(geneModels) gtrack <-…
dan
  • 6,048
  • 10
  • 57
  • 125
0
votes
1 answer

ggplot2 vs cowplot, Error in FUN("text"[[1L]], ...) :

I'm trying to use cowplot to combine some ggplot2 plots. It should be straightforward, but something in my R or Rstudio surly is broken. What I don't know. I can get it to work with grid.arrange, but the output in my rmarkdown file does not come…
Nick
  • 179
  • 1
  • 11
0
votes
2 answers

Labels do not align correctly in 12 panel figure using Cowplot - plot.grid

When I create a 12 panel figure (3 row by 4 col) using plot_grid in Cowplot, the labels in the third row do not align with others after "hjust = -6". Please help with the label positions in the third row. Thanks for the help. PP1 <- ggplot(mpg,…
Z.Chen
  • 11
  • 1
-1
votes
1 answer

How can I create a plot grid from plots created with different data with different aesthetic length?

I tried to create a plot grid that shows all the interactions from my model in separate panels with ggarrange from the ggpubr package and with plot_grid from the cowplot package. In both cases I get the error message: "Aesthetics must be either…
-1
votes
1 answer

R: fct_reorder() and making a grid of plots - not compatible?

I'm using fct_reorder() to order the levels of my factors in ggplot. That works fine for individual plots. But when I use plot_grid() from cowplot, there is some kind of problem. For contrast, to the left, I've used a plot that has fixed factor…
Alex
  • 779
  • 2
  • 7
  • 20
-1
votes
1 answer

using cowplot to stitch bar plot (stat=identity) to point plot using cowplot - error

I am running into an error when I try to stitch together a bar plot and point plot using cowplot. I can try to put together a working example if requested, but I thought I'd first just see if anyone could spot an obvious problem. The code and…
-2
votes
1 answer

Add picture instead of figure

I would like to add jpeg picture in a place of 'ao' in the following figure library(ggplot2) da <- data.frame(x = seq(0, 100, 1), y = seq(0, 1, 0.01)) ao <- ggplot() a1 <- ggplot(aes(x = x, y = y), data = da) + geom_line() a2 <- ggplot(aes(x = x, y…
Mateusz1981
  • 1,817
  • 17
  • 33
-2
votes
2 answers

How do I leave the graph centralized by ggplot2

I have following commands by cowplot require(cowplot); tiff('./solution/AGM2.tiff', height = 18,width = 25, units = 'in',res = 60) plot_grid(a28 + theme(axis.title.y = element_text(size =40), axis.title.x=element_text(size…
Greg Rov
  • 327
  • 3
  • 12
1 2 3
18
19