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

Make the bottom of the density and histogram y axes aligned?

I draw the density and histogram on the same plot I can do as follows: set.seed(1) ex=rnorm(4000 , 120 , 30) hist(ex, col="#00AFBB", prob=TRUE, breaks=100) lines(density(ex), col="#E7B800") But I don't want to set the prob as TRUE, hence I…
Lerner Zhang
  • 6,184
  • 2
  • 49
  • 66
0
votes
0 answers

Why cannot I install R package "cowplot"?

When I try doing install.packages("cowplot") I get the following output: Installing package into ‘/insertdirectoryname/R/x86_64-pc-linux-gnu-library/3.5’ (as ‘lib’ is unspecified) trying URL…
Dan
  • 9
  • 1
0
votes
2 answers

R - How to remove 'seperation' line and backround borcers in single plot / multi-plot grids

This is driving me nuts. Have two ggplot objects p and q and use the elegant cowplot::plot_grid function to combine both plots in said grid. However I do get a kind of separation line between the two arranged plots. I use the code…
aimbotter21
  • 191
  • 1
  • 7
0
votes
0 answers

How do I select a panel from the jnplot from the probe_interactions() function in interactions() in R?

I would like to select one panel from the jnplot generated by probe_interactions() for a three-way interactions. The get_panel() command from cowplot does not seem to work here. Does anybody know whther this is possible? I may be overlooking…
ggvh
  • 1
0
votes
0 answers

ggsave alters figure when exporting to pdf

I've created a complex multi-facet figure using ggplot. When I save it using the basic ggsave command: ggsave("myplot.pdf", plot = my.plot) The margins of the figure facets and of the labels get changed. What it looks like in the Rstudio plot…
Nereus
  • 47
  • 5
0
votes
1 answer

difficulty in using plot_grid and get_legend in R

I am finding difficulty in using plot_grid() and get_legend() in cowplot in R I generated six plots using the sample code below. I want to use plot_grid() in cowplot to arrange in 4 rows: row1 - title of plot ("Sample Plot" at the center) row2 -…
SiH
  • 1,378
  • 4
  • 18
0
votes
0 answers

Omitting optional inputs when not needed

I have three ggplots : Simple dotplot, ACF, quantile-quntile plot. I want to write a function which has certain features. It should by default plot all three plots, but it should have input plot_types and there I can specify which exactly plots…
John
  • 1,849
  • 2
  • 13
  • 23
0
votes
1 answer

Using `extrafont` with `cowplot`: font width unknown for character error

I'm trying to use a font in ggplot that I can only get through the extrafont package. When I then want to combine multiple plots using the cowplot package, I always a large number of errors of the sort: 46: In grid.Call(C_textBounds,…
Moritz Schwarz
  • 2,019
  • 2
  • 15
  • 33
0
votes
2 answers

Plotting two graphs getting the error: Cannot convert object of class list into a grob

I am trying to place two boxplots (box1, box2) beside each other and to label them "A" and "B" in the upper left corner. I am trying to use the cowplot-package for this. This is the function: plot_grid(box1, box2, labels = c('A', 'B'), label_size =…
Alvida
  • 15
  • 1
  • 4
0
votes
2 answers

make a common legend and include unique legend attributes

I am attempting to combine a legend for two plots with a shared blue line and unique bar colors (read and yellow). When plotting the code below only two of the three colored id's show up in the combined legend (red and blue) but I want the third…
0
votes
1 answer

Naming a base R plot (map) created over multiple lines

Is there a way to name this plot (map). It is created with over multiple lines and even a loop. I'd like to name it so I can use it with cowplot or grid arrange. #create basemap maps::map("world", regions=c("usa"), fill=T, col="#898f9c",…
Jdv
  • 329
  • 1
  • 10
0
votes
2 answers

How to add one common y and x label for an arrange of plots and also a label for several columns of this arrange in R?

I have an arrange of 16 plots (4x4). The last column of this arrange is the legend, that is common for each row. I add below a fake code to create something similar to what I…
Dekike
  • 1,264
  • 6
  • 17
0
votes
1 answer

How to align y axis by 0 between plots with plot_grid function in R?

I made several weekley plots of different gaseous compounds (BVOCs) with ggplot and I put them together with plot_grid function. Obviously compounds have different scales and Y axis are not aligned. I wish align them by zero on Y axis. I think that…
Antonio Manco
  • 217
  • 2
  • 14
0
votes
1 answer

How to add text bar at the top of a cowplot?

I have a stuckplot of several plots made using cowplot function in ggplot. I want to add an "header", a boxed text at top of the cowplot. They should be five box, with each box length that follow a precise range of time, which is showed only in the…
Antonio Manco
  • 217
  • 2
  • 14
0
votes
0 answers

How to cross-reference cowplot subfigure labels in Rmarkdown document (bookdown)?

I have a knitr R-chunk where multiple ggplot2s that are arranged to one figure using cowplot and labelled using cowplot labels. I'd like to reference the individual plots in the figure, i.e. 1A, 1B, 1C, in my text I've tried the fig.subcap knitr…
Shudras
  • 117
  • 2
  • 8