Skip to content

Commit

Permalink
Disambiguate class name
Browse files Browse the repository at this point in the history
So you can use ggplot1 and ggplot2 in the same session
  • Loading branch information
hadley committed Aug 18, 2019
1 parent a4b5cfc commit d0a686d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method("$",ggplot)
S3method("$",ggplot1)
S3method("update<-",categorical)
S3method("update<-",continuous)
S3method("update<-",gradient)
Expand Down Expand Up @@ -48,7 +48,7 @@ S3method(output,scale_cont_colour)
S3method(output,scales)
S3method(print,categorical)
S3method(print,continuous)
S3method(print,ggplot)
S3method(print,ggplot1)
S3method(print,gradient)
S3method(print,manual)
S3method(print,options)
Expand All @@ -59,7 +59,7 @@ S3method(range,continuous)
S3method(range,ps_double)
S3method(range,scale)
S3method(range,scales)
S3method(summary,ggplot)
S3method(summary,ggplot1)
export("%>%")
export(alpha)
export(chop)
Expand Down
2 changes: 1 addition & 1 deletion R/options.r
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ ggtheme <- function(theme) {
}

#' @export
"$.ggplot" <- function(x, i) {
"$.ggplot1" <- function(x, i) {
if (i %in% names(x)) {
x[[i]]
} else {
Expand Down
4 changes: 2 additions & 2 deletions R/plot.r
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ ggplot.default <- function(data = NULL, aesthetics=list(), formula = . ~ ., marg
defaults = uneval(substitute(aesthetics)),
title = "",
fixedaspect = FALSE
), class="ggplot")
), class="ggplot1")

p$xlabel <- if (!is.null(p$defaults$x)) deparse(p$defaults$x) else ""
p$ylabel <- if (!is.null(p$defaults$y)) deparse(p$defaults$y) else ""
Expand All @@ -157,7 +157,7 @@ ggplot.default <- function(data = NULL, aesthetics=list(), formula = . ~ ., marg


#' @export
print.ggplot <- function(x, newpage = is.null(vp), vp = NULL, save=ggopt()$save, ...) {
print.ggplot1 <- function(x, newpage = is.null(vp), vp = NULL, save=ggopt()$save, ...) {
if (newpage) grid.newpage()
if (is.null(vp)) {
grid.draw(ggplot_plot(x, ...))
Expand Down
2 changes: 1 addition & 1 deletion R/summary.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @export
summary.ggplot <- function(object, ...) {
summary.ggplot1 <- function(object, ...) {
defaults <- function() {
paste(mapply(function(x, n) {
paste(n, deparse(x), sep="=")
Expand Down

0 comments on commit d0a686d

Please sign in to comment.