From 56fcee4576f8ebc7ad3ed9bc75177d90f992b9d8 Mon Sep 17 00:00:00 2001 From: Claus Wilke Date: Thu, 27 Oct 2016 15:32:18 -0500 Subject: [PATCH] ready for version 0.7. --- DESCRIPTION | 4 ++-- NEWS | 4 ++-- R/themes.R | 3 +++ cran-comments.md | 6 +++--- inst/doc/introduction.html | 6 +++--- inst/doc/plot_annotations.Rmd | 2 +- inst/doc/plot_annotations.html | 2 +- inst/doc/shared_legends.html | 8 ++++---- vignettes/plot_annotations.Rmd | 2 +- 9 files changed, 20 insertions(+), 17 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index aae77a6..faeb4e8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: cowplot Title: Streamlined Plot Theme and Plot Annotations for 'ggplot2' -Version: 0.6.9990 +Version: 0.7.0 Authors@R: c( person("Claus O.", "Wilke", role = c("aut", "cre"), email = "wilke@austin.utexas.edu"), person("Hadley", "Wickham", role = c("cph"), email = "h.wickham@gmail.com") ) @@ -13,7 +13,7 @@ Description: Some helpful extensions and modifications to the 'ggplot2' URL: https://github.com/wilkelab/cowplot Depends: R (>= 3.3.0), - ggplot2 (>= 2.0.0), + ggplot2 (>= 2.1.0), Imports: grid (>= 3.0.0), gtable (>= 0.1.2), diff --git a/NEWS b/NEWS index 36d1604..2e159d4 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ -cowplot 0.6.9990 +cowplot 0.7.0 ---------------------------------------------------------------- -- The development version of cowplot is being prepared for the upcoming release of ggplot2 2.2.0. As a result of this upcoming switch, the function switch_axis_position() has been deprecated. Alternative axes will be natively supported by ggplot2 2.2.0. +- This version of cowplot has been prepared for the upcoming release of ggplot2 2.2.0. As a result of this upcoming switch, the function switch_axis_position() has been removed. Alternative axes will be natively supported by ggplot2 2.2.0. - As of this version, cowplot requires R >= 3.3.0. This dependency was added because R 3.3 fixes a critical problem with lists of units. cowplot 0.6.3 diff --git a/R/themes.R b/R/themes.R index 6e21b4d..78b4a49 100644 --- a/R/themes.R +++ b/R/themes.R @@ -38,6 +38,9 @@ theme_cowplot <- function(font_size = 14, font_family = "", line_size = .5) { ), axis.ticks = element_line(colour = "black", size = line_size), axis.line = element_line(colour = "black", size = line_size), + # the following two lines are not needed for ggplot2 2.2.0 or later + axis.line.x = element_line(colour = "black", size = line_size), + axis.line.y = element_line(colour = "black", size = line_size), legend.key = element_blank(), legend.key.size = grid::unit(1, "lines"), legend.text = element_text(size = rel(small_rel)), diff --git a/cran-comments.md b/cran-comments.md index e5427ed..22a5aa9 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,7 +1,7 @@ -Fixed the URL in README.md and replaced the word "library" with "package" in DESCRIPTION. +This submission prepares cowplot for the upcoming ggplot2 2.2.0 release. ## Test environments -* R 3.3.1 on win-builder [ via devtools::build_win() ] +* R devel and R 3.3.1 on win-builder [ via devtools::build_win() ] * local OS X install x86_64-apple-darwin13.4.0 (64-bit), R 3.3.1 ## R CMD check results @@ -20,7 +20,7 @@ All clear, according to devtools::revdep_check(): Checked IncucyteDRC : 0 errors | 0 warnings | 0 notes Checked JWileymisc : 0 errors | 0 warnings | 0 notes Checked poppr : 0 errors | 0 warnings | 0 notes +Checked preText : 0 errors | 0 warnings | 1 note Checked rnrfa : 0 errors | 0 warnings | 0 notes Checked tadaatoolbox: 0 errors | 0 warnings | 1 note -The note for the last package is unrelated to cowplot. diff --git a/inst/doc/introduction.html b/inst/doc/introduction.html index bbe73b8..2076e12 100644 --- a/inst/doc/introduction.html +++ b/inst/doc/introduction.html @@ -162,15 +162,15 @@

Generic plot annotations

draw_plot(plot.mpg) + draw_label("Plot is on top of the grey boxes", x = 1, y = 1, vjust = 1, hjust = 1, size = 10, fontface = 'bold') -
## Warning: Removed 4 rows containing missing values (geom_rect).
+
## Warning: Removed 1 rows containing missing values (geom_rect).
# plot below annotations
 ggdraw(plot.mpg) + 
   geom_rect(data = boxes, aes(xmin = x, xmax = x + .15, ymin = y, ymax = y + .15),
             colour = "gray60", fill = "gray80") + 
   draw_label("Plot is underneath the grey boxes", x = 1, y = 1,
             vjust = 1, hjust = 1, size = 10, fontface = 'bold')
-
## Warning: Removed 4 rows containing missing values (geom_rect).
-

+
## Warning: Removed 1 rows containing missing values (geom_rect).
+

Note that placing a plot on top of annotations only makes sense if the plot background is transparent. This is one of the main differences between theme_cowplot() and theme_classic(). If you tried the same example with theme_classic(), the gray boxes underneath the plot would not show.

Finally, the draw_plot() function also allows us to place graphs at arbitrary locations and at arbitrary sizes onto the canvas. This is useful for combining subplots into a layout that is not a simple grid, e.g. with one sub-plot spanning the entire width of the figure and two other figures using up half of the figure width:

plot.iris <- ggplot(iris, aes(Sepal.Length, Sepal.Width)) + 
diff --git a/inst/doc/plot_annotations.Rmd b/inst/doc/plot_annotations.Rmd
index b96a0e2..f91778b 100644
--- a/inst/doc/plot_annotations.Rmd
+++ b/inst/doc/plot_annotations.Rmd
@@ -14,7 +14,7 @@ vignette: >
 library(cowplot)
 ```
 
-The **cowplot** package provides a variety of functions to annotate plots, including annotations underneath the plot, mathematical expressions inside plots, and joint titles for combined plots.
+The **cowplot** package provides a variety of functions to annotate plots, including annotations underneath the plot, mathematical expressions inside plots, and joint titles for combined plots. Note that as **ggplot2** gains more of this functionality natively (e.g. as of version 2.2.0), we recommend to use the **ggplot2** methods rather than the **cowplot** methods. Any functionality that is duplicated between **ggplot2** and **cowplot** may be removed from future versions of **cowplot**.
 
 ## Annotations underneath plots
 
diff --git a/inst/doc/plot_annotations.html b/inst/doc/plot_annotations.html
index fd2590e..7b6b603 100644
--- a/inst/doc/plot_annotations.html
+++ b/inst/doc/plot_annotations.html
@@ -74,7 +74,7 @@ 

2016-10-26

-

The cowplot package provides a variety of functions to annotate plots, including annotations underneath the plot, mathematical expressions inside plots, and joint titles for combined plots.

+

The cowplot package provides a variety of functions to annotate plots, including annotations underneath the plot, mathematical expressions inside plots, and joint titles for combined plots. Note that as ggplot2 gains more of this functionality natively (e.g. as of version 2.2.0), we recommend to use the ggplot2 methods rather than the cowplot methods. Any functionality that is duplicated between ggplot2 and cowplot may be removed from future versions of cowplot.

Annotations underneath plots

The function add_sub() can be used to add annotation text underneath a plot. To demonstrate its use, we first make a plot:

diff --git a/inst/doc/shared_legends.html b/inst/doc/shared_legends.html index 2b705b0..34c4b23 100644 --- a/inst/doc/shared_legends.html +++ b/inst/doc/shared_legends.html @@ -98,7 +98,7 @@

2016-10-26

nrow = 1 ) prow
-

+

Legend to the side:

# extract the legend from one of the plots
 # (clearly the whole thing only makes sense if all plots
@@ -109,7 +109,7 @@ 

2016-10-26

# of one plot (via rel_widths). p <- plot_grid( prow, legend, rel_widths = c(3, .3)) p
-

+

Legend at the bottom:

# extract the legend from one of the plots
 # (clearly the whole thing only makes sense if all plots
@@ -120,7 +120,7 @@ 

2016-10-26

# of one plot (via rel_heights). p <- plot_grid( prow, legend_b, ncol = 1, rel_heights = c(1, .2)) p
-

+

Legend between plots:

# arrange the three plots in a single row, leaving space between plot B and C
 prow <- plot_grid( p1 + theme(legend.position="none"),
@@ -135,7 +135,7 @@ 

2016-10-26

) prow + draw_grob(legend, 2/3.3, 0, .3/3.3, 1)
-

+

diff --git a/vignettes/plot_annotations.Rmd b/vignettes/plot_annotations.Rmd index b96a0e2..f91778b 100644 --- a/vignettes/plot_annotations.Rmd +++ b/vignettes/plot_annotations.Rmd @@ -14,7 +14,7 @@ vignette: > library(cowplot) ``` -The **cowplot** package provides a variety of functions to annotate plots, including annotations underneath the plot, mathematical expressions inside plots, and joint titles for combined plots. +The **cowplot** package provides a variety of functions to annotate plots, including annotations underneath the plot, mathematical expressions inside plots, and joint titles for combined plots. Note that as **ggplot2** gains more of this functionality natively (e.g. as of version 2.2.0), we recommend to use the **ggplot2** methods rather than the **cowplot** methods. Any functionality that is duplicated between **ggplot2** and **cowplot** may be removed from future versions of **cowplot**. ## Annotations underneath plots