Skip to content

Commit e4b870b

Browse files
committed
adapt failing example
1 parent 9f69323 commit e4b870b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

R/plot-construction.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,18 @@ add_ggplot <- function(p, object, objectname) {
9898
#' @export
9999
#' @examples
100100
#' # making a new method for the generic
101-
#' # in this example, we apply a text element to the text theme setting
102-
#' ggplot_add.element_text <- function(object, plot, object_name) {
103-
#' plot + theme(text = object)
101+
#' # in this example, we apply a colour to the plot background
102+
#' ggplot_add.character <- function(object, plot, object_name) {
103+
#' plot + theme(plot.background = element_rect(fill = object))
104104
#' }
105105
#'
106106
#' # we can now use `+` to add our object to a plot
107107
#' ggplot(mpg, aes(displ, cty)) +
108108
#' geom_point() +
109-
#' element_text(colour = "red")
109+
#' "cornsilk"
110110
#'
111111
#' # clean-up
112-
#' rm(ggplot_add.element_text)
112+
#' rm(ggplot_add.character)
113113
ggplot_add <- function(object, plot, object_name) {
114114
UseMethod("ggplot_add")
115115
}

man/ggplot_add.Rd

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)