Permalink
Browse files

Add plot.ggplot. Fixes #478

  • Loading branch information...
1 parent 7785c08 commit b49056bf07aaefb1811364d384d8206e7864fd05 @hadley hadley committed Apr 12, 2012
Showing with 13 additions and 1 deletion.
  1. +1 −0 NAMESPACE
  2. +2 −0 NEWS
  3. +6 −1 R/plot-render.r
  4. +4 −0 man/print.ggplot.Rd
View
@@ -333,6 +333,7 @@ S3method(limits,factor)
S3method(limits,numeric)
S3method(limits,POSIXct)
S3method(limits,POSIXlt)
+S3method(plot,ggplot)
S3method(predictdf,default)
S3method(predictdf,glm)
S3method(predictdf,locfit)
View
@@ -1,3 +1,5 @@
+* Added `plot` as an alias for `print` for ggplot objects.
+
* Visual tests have been moved to /visual_test and modified to work with the
vtest package. (Thanks to Winston Chang)
View
@@ -162,7 +162,7 @@ ggplot_gtable <- function(data) {
#' @param vp viewport to draw plot in
#' @param ... other arguments not used by this method
#' @keywords hplot
-#' @S3method print ggplot
+#' @export
#' @method print ggplot
print.ggplot <- function(x, newpage = is.null(vp), vp = NULL, ...) {
set_last_plot(x)
@@ -181,6 +181,11 @@ print.ggplot <- function(x, newpage = is.null(vp), vp = NULL, ...) {
invisible(data)
}
+#' @rdname print.ggplot
+#' @method plot ggplot
+#' @export
+plot.ggplot <- print.ggplot
+
#' Generate a ggplot2 plot grob.
#'
View
@@ -1,9 +1,13 @@
\name{print.ggplot}
+\alias{plot.ggplot}
\alias{print.ggplot}
\title{Draw plot on current graphics device.}
\usage{
\method{print}{ggplot} (x, newpage = is.null(vp),
vp = NULL, ...)
+
+ \method{plot}{ggplot} (x, newpage = is.null(vp),
+ vp = NULL, ...)
}
\arguments{
\item{x}{plot to display}

0 comments on commit b49056b

Please sign in to comment.