diff --git a/R/geom-margin-arrow.r b/R/geom-margin-arrow.r index 82156df..7fbc9df 100644 --- a/R/geom-margin-arrow.r +++ b/R/geom-margin-arrow.r @@ -44,8 +44,6 @@ #' @examples #' p <- ggplot(mtcars, aes(wt, mpg)) + #' geom_point() -#' p -#' p + geom_x_margin_arrow(xintercept = 3.5) #' p + geom_y_margin_arrow(yintercept = c(18, 28, 15)) #' p + geom_x_margin_arrow(data = data.frame(x = c(2.5, 4.5)), #' mapping = aes(xintercept = x)) diff --git a/R/geom-margin-grob.r b/R/geom-margin-grob.r index b8a064c..5ab986b 100644 --- a/R/geom-margin-grob.r +++ b/R/geom-margin-grob.r @@ -53,9 +53,6 @@ #' @examples #' # We can add icons to the margin of a plot to signal events #' -#' -#' -#' geom_x_margin_grob <- function(mapping = NULL, data = NULL, stat = "identity", position = "identity", ..., diff --git a/R/geom-margin-point.r b/R/geom-margin-point.r index e04e63f..deb3857 100644 --- a/R/geom-margin-point.r +++ b/R/geom-margin-point.r @@ -45,8 +45,6 @@ #' @examples #' p <- ggplot(mtcars, aes(wt, mpg)) + #' geom_point() -#' p -#' p + geom_x_margin_point(xintercept = 3.5) #' p + geom_y_margin_point(yintercept = c(18, 28, 15)) #' p + geom_x_margin_point(data = data.frame(x = c(2.5, 4.5)), #' mapping = aes(xintercept = x)) diff --git a/R/geom-quadrant-lines.R b/R/geom-quadrant-lines.R index 3ea9f5c..f94b206 100644 --- a/R/geom-quadrant-lines.R +++ b/R/geom-quadrant-lines.R @@ -64,10 +64,6 @@ #' geom_point() #' #' ggplot(my.data, aes(x, y)) + -#' geom_quadrant_lines(linetype = "dotted") + -#' geom_point() -#' -#' ggplot(my.data, aes(x, y)) + #' geom_quadrant_lines(xintercept = 50, #' yintercept = 10, #' colour = "blue") + @@ -81,14 +77,6 @@ #' #' ggplot(my.data, aes(x, y)) + #' geom_vhlines(xintercept = c(25, 50, 75), -#' yintercept = 10 , -#' linetype = "dotted", -#' colour = "red") + -#' geom_point() + -#' theme_bw() -#' -#' ggplot(my.data, aes(x, y)) + -#' geom_vhlines(xintercept = c(25, 50, 75), #' yintercept = c(10, 8), #' linetype = "dotted", #' colour = "red") + diff --git a/R/geom-table.R b/R/geom-table.R index 989f2b6..98eaa65 100644 --- a/R/geom-table.R +++ b/R/geom-table.R @@ -204,15 +204,6 @@ #' arrow = arrow(length = unit(0.5, "lines"))) + #' theme_classic() #' -#' # Using native plot coordinates instead of data coordinates -#' dfnpc <- tibble(x = 0.95, y = 0.95, tb = list(tb)) -#' -#' ggplot(mtcars, -#' aes(wt, mpg, colour = factor(cyl))) + -#' geom_point() + -#' geom_table_npc(data = dfnpc, -#' aes(npcx = x, npcy = y, label = tb)) -#' geom_table <- function(mapping = NULL, data = NULL, stat = "identity", position = "identity", ..., diff --git a/R/geom-text-linked.r b/R/geom-text-linked.r index 4b5afa6..bd1e2d2 100644 --- a/R/geom-text-linked.r +++ b/R/geom-text-linked.r @@ -193,19 +193,11 @@ #' geom_text_s(hjust = "left", nudge_x = 0.12) + #' expand_limits(x = 6.2) #' p + -#' geom_text_s(nudge_y = 0.1, nudge_x = 0.07) + -#' expand_limits(x = 6.2) -#' p + #' geom_text_s(nudge_y = 1, angle = 90) + #' expand_limits(y = 30) #' p + #' geom_text_s(angle = 90, nudge_y = 1, #' arrow = arrow(length = grid::unit(1.5, "mm")), -#' colour.target = "segment", colour = "red") + -#' expand_limits(y = 30) -#' p + -#' geom_text_s(angle = 90, nudge_y = 1, -#' arrow = arrow(length = grid::unit(1.5, "mm")), #' alpha.target = "segment", alpha = 0.3) + #' expand_limits(y = 30) #' @@ -226,12 +218,6 @@ #' p + #' geom_label_s(hjust = "outward_1", nudge_x = 0.12) + #' expand_limits(x = 6.2) -#' p + -#' geom_label_s(hjust = "inward_3", nudge_y = 0.4) -#' -#' p + -#' geom_label_s(nudge_y = 1, angle = 90) + -#' expand_limits(y = 30) #' #' # Add aesthetic mappings and adjust arrows #' p + @@ -260,24 +246,6 @@ #' expand_limits(y = 27) #' #' p + -#' geom_label_s(aes(colour = factor(cyl)), -#' nudge_x = 0.3, -#' arrow = arrow(angle = 20, -#' length = grid::unit(1/3, "lines"))) + -#' scale_colour_discrete(l = 40) + # luminance, make colours darker -#' expand_limits(x = 7) -#' -#' p + -#' geom_label_s(aes(colour = factor(cyl)), -#' nudge_x = 0.3, -#' colour.target = c("box", "segment"), -#' linewidth = 0.6, -#' arrow = arrow(angle = 20, -#' length = grid::unit(1/3, "lines"))) + -#' scale_colour_discrete(l = 40) + # luminance, make colours darker -#' expand_limits(x = 7) -#' -#' p + #' geom_label_s(aes(colour = factor(cyl), fill = factor(cyl)), #' nudge_x = 0.3, #' alpha.target = "box", @@ -288,11 +256,6 @@ #' scale_colour_discrete(l = 40) + # luminance, make colours darker #' expand_limits(x = 7)#' # Scale height of text, rather than sqrt(height) #' -#' p + -#' geom_text_s(aes(size = wt), nudge_x = -0.1) + -#' scale_radius(range = c(3,6)) + # override scale_area() -#' expand_limits(x = c(1.8, 5.5)) -#' geom_text_s <- function(mapping = NULL, data = NULL, stat = "identity", diff --git a/R/geom-text-npc.r b/R/geom-text-npc.r index 413f281..cd6f77e 100644 --- a/R/geom-text-npc.r +++ b/R/geom-text-npc.r @@ -87,11 +87,6 @@ #' geom_point() + #' geom_text_npc(data = df, aes(npcx = x, npcy = y, label = text)) #' -#' ggplot(data = mtcars, mapping = aes(wt, mpg)) + -#' geom_point() + -#' geom_text_npc(data = df, aes(npcx = x, npcy = y, label = text)) + -#' expand_limits(y = 40, x = 6) -#' #' ggplot(data = mtcars) + #' geom_point(mapping = aes(wt, mpg)) + #' geom_label_npc(data = df, aes(npcx = x, npcy = y, label = text)) diff --git a/R/geom-text-pairwise.R b/R/geom-text-pairwise.R index f231ec2..d512a48 100644 --- a/R/geom-text-pairwise.R +++ b/R/geom-text-pairwise.R @@ -166,27 +166,6 @@ #' parse = TRUE) #' #' p1 + -#' geom_text_pairwise(data = my.pairs, -#' aes(xmin = A, xmax = B, -#' y = bar.height, -#' label = sprintf("italic(P)~`=`~%.2f", p.value)), -#' arrow = grid::arrow(angle = 90, -#' length = unit(1, "mm"), -#' ends = "both"), -#' parse = TRUE) -#' -#' p1 + -#' geom_text_pairwise(data = my.pairs, -#' aes(xmin = A, xmax = B, -#' y = bar.height, -#' label = sprintf("italic(P)~`=`~%.2f", p.value)), -#' colour = "red", -#' arrow = grid::arrow(angle = 90, -#' length = unit(1, "mm"), -#' ends = "both"), -#' parse = TRUE) -#' -#' p1 + #' geom_label_pairwise(data = my.pairs, #' aes(xmin = A, xmax = B, #' y = bar.height, @@ -237,18 +216,6 @@ #' y = bar.height, label = text)) #' #' p2 + -#' geom_text_pairwise(data = my.ranges, -#' aes(xmin = A, xmax = B, -#' y = bar.height, label = text), -#' angle = 90, hjust = -0.1) -#' -#' p2 + -#' geom_label_pairwise(data = my.ranges, -#' aes(xmin = A, xmax = B, -#' y = bar.height, label = text), -#' angle = 90, hjust = -0.1) -#' -#' p2 + #' geom_label_pairwise(data = my.ranges, #' aes(xmin = A, xmax = B, #' y = bar.height, label = text)) diff --git a/man/geom_quadrant_lines.Rd b/man/geom_quadrant_lines.Rd index d6877b0..6885d51 100644 --- a/man/geom_quadrant_lines.Rd +++ b/man/geom_quadrant_lines.Rd @@ -101,10 +101,6 @@ ggplot(my.data, aes(x, y)) + geom_quadrant_lines() + geom_point() -ggplot(my.data, aes(x, y)) + - geom_quadrant_lines(linetype = "dotted") + - geom_point() - ggplot(my.data, aes(x, y)) + geom_quadrant_lines(xintercept = 50, yintercept = 10, @@ -117,14 +113,6 @@ ggplot(my.data, aes(x, y)) + colour = "blue") + geom_point() -ggplot(my.data, aes(x, y)) + - geom_vhlines(xintercept = c(25, 50, 75), - yintercept = 10 , - linetype = "dotted", - colour = "red") + - geom_point() + - theme_bw() - ggplot(my.data, aes(x, y)) + geom_vhlines(xintercept = c(25, 50, 75), yintercept = c(10, 8), diff --git a/man/geom_table.Rd b/man/geom_table.Rd index 0358d14..1e44b8a 100644 --- a/man/geom_table.Rd +++ b/man/geom_table.Rd @@ -306,15 +306,6 @@ ggplot(mtcars, arrow = arrow(length = unit(0.5, "lines"))) + theme_classic() -# Using native plot coordinates instead of data coordinates -dfnpc <- tibble(x = 0.95, y = 0.95, tb = list(tb)) - -ggplot(mtcars, - aes(wt, mpg, colour = factor(cyl))) + - geom_point() + - geom_table_npc(data = dfnpc, - aes(npcx = x, npcy = y, label = tb)) - } \references{ This geometry is inspired on answers to two questions in diff --git a/man/geom_text_npc.Rd b/man/geom_text_npc.Rd index dbdf3c2..85415b2 100644 --- a/man/geom_text_npc.Rd +++ b/man/geom_text_npc.Rd @@ -170,11 +170,6 @@ ggplot(data = mtcars, mapping = aes(wt, mpg)) + geom_point() + geom_text_npc(data = df, aes(npcx = x, npcy = y, label = text)) -ggplot(data = mtcars, mapping = aes(wt, mpg)) + - geom_point() + - geom_text_npc(data = df, aes(npcx = x, npcy = y, label = text)) + - expand_limits(y = 40, x = 6) - ggplot(data = mtcars) + geom_point(mapping = aes(wt, mpg)) + geom_label_npc(data = df, aes(npcx = x, npcy = y, label = text)) diff --git a/man/geom_text_pairwise.Rd b/man/geom_text_pairwise.Rd index 77282e4..c507534 100644 --- a/man/geom_text_pairwise.Rd +++ b/man/geom_text_pairwise.Rd @@ -243,27 +243,6 @@ p1 + label = p.value), parse = TRUE) -p1 + - geom_text_pairwise(data = my.pairs, - aes(xmin = A, xmax = B, - y = bar.height, - label = sprintf("italic(P)~`=`~\%.2f", p.value)), - arrow = grid::arrow(angle = 90, - length = unit(1, "mm"), - ends = "both"), - parse = TRUE) - -p1 + - geom_text_pairwise(data = my.pairs, - aes(xmin = A, xmax = B, - y = bar.height, - label = sprintf("italic(P)~`=`~\%.2f", p.value)), - colour = "red", - arrow = grid::arrow(angle = 90, - length = unit(1, "mm"), - ends = "both"), - parse = TRUE) - p1 + geom_label_pairwise(data = my.pairs, aes(xmin = A, xmax = B, @@ -314,18 +293,6 @@ p2 + aes(xmin = A, xmax = B, y = bar.height, label = text)) -p2 + - geom_text_pairwise(data = my.ranges, - aes(xmin = A, xmax = B, - y = bar.height, label = text), - angle = 90, hjust = -0.1) - -p2 + - geom_label_pairwise(data = my.ranges, - aes(xmin = A, xmax = B, - y = bar.height, label = text), - angle = 90, hjust = -0.1) - p2 + geom_label_pairwise(data = my.ranges, aes(xmin = A, xmax = B, diff --git a/man/geom_text_s.Rd b/man/geom_text_s.Rd index b50f7ba..f38996f 100644 --- a/man/geom_text_s.Rd +++ b/man/geom_text_s.Rd @@ -284,17 +284,9 @@ p + p + geom_text_s(hjust = "left", nudge_x = 0.12) + expand_limits(x = 6.2) -p + - geom_text_s(nudge_y = 0.1, nudge_x = 0.07) + - expand_limits(x = 6.2) p + geom_text_s(nudge_y = 1, angle = 90) + expand_limits(y = 30) -p + - geom_text_s(angle = 90, nudge_y = 1, - arrow = arrow(length = grid::unit(1.5, "mm")), - colour.target = "segment", colour = "red") + - expand_limits(y = 30) p + geom_text_s(angle = 90, nudge_y = 1, arrow = arrow(length = grid::unit(1.5, "mm")), @@ -318,12 +310,6 @@ p + p + geom_label_s(hjust = "outward_1", nudge_x = 0.12) + expand_limits(x = 6.2) -p + - geom_label_s(hjust = "inward_3", nudge_y = 0.4) - -p + - geom_label_s(nudge_y = 1, angle = 90) + - expand_limits(y = 30) # Add aesthetic mappings and adjust arrows p + @@ -351,24 +337,6 @@ p + scale_colour_discrete(l = 40) + # luminance, make colours darker expand_limits(y = 27) -p + - geom_label_s(aes(colour = factor(cyl)), - nudge_x = 0.3, - arrow = arrow(angle = 20, - length = grid::unit(1/3, "lines"))) + - scale_colour_discrete(l = 40) + # luminance, make colours darker - expand_limits(x = 7) - -p + - geom_label_s(aes(colour = factor(cyl)), - nudge_x = 0.3, - colour.target = c("box", "segment"), - linewidth = 0.6, - arrow = arrow(angle = 20, - length = grid::unit(1/3, "lines"))) + - scale_colour_discrete(l = 40) + # luminance, make colours darker - expand_limits(x = 7) - p + geom_label_s(aes(colour = factor(cyl), fill = factor(cyl)), nudge_x = 0.3, @@ -380,11 +348,6 @@ p + scale_colour_discrete(l = 40) + # luminance, make colours darker expand_limits(x = 7)#' # Scale height of text, rather than sqrt(height) -p + - geom_text_s(aes(size = wt), nudge_x = -0.1) + - scale_radius(range = c(3,6)) + # override scale_area() - expand_limits(x = c(1.8, 5.5)) - } \seealso{ \code{\link[ggplot2]{geom_text}}, \code{\link[ggplot2]{geom_label}} diff --git a/man/geom_x_margin_arrow.Rd b/man/geom_x_margin_arrow.Rd index 89d4289..dbb07e8 100644 --- a/man/geom_x_margin_arrow.Rd +++ b/man/geom_x_margin_arrow.Rd @@ -87,8 +87,6 @@ personality" as both annotations and geometries. \examples{ p <- ggplot(mtcars, aes(wt, mpg)) + geom_point() -p -p + geom_x_margin_arrow(xintercept = 3.5) p + geom_y_margin_arrow(yintercept = c(18, 28, 15)) p + geom_x_margin_arrow(data = data.frame(x = c(2.5, 4.5)), mapping = aes(xintercept = x)) diff --git a/man/geom_x_margin_grob.Rd b/man/geom_x_margin_grob.Rd index 5fead20..6a44358 100644 --- a/man/geom_x_margin_grob.Rd +++ b/man/geom_x_margin_grob.Rd @@ -124,9 +124,6 @@ personality" as both annotations and geometries. \examples{ # We can add icons to the margin of a plot to signal events - - - } \seealso{ \code{\link[grid]{grid-package}}, \code{\link[ggplot2]{geom_rug}}, diff --git a/man/geom_x_margin_point.Rd b/man/geom_x_margin_point.Rd index 63c4a6e..629741d 100644 --- a/man/geom_x_margin_point.Rd +++ b/man/geom_x_margin_point.Rd @@ -87,8 +87,6 @@ personality" as both annotations and geometries. \examples{ p <- ggplot(mtcars, aes(wt, mpg)) + geom_point() -p -p + geom_x_margin_point(xintercept = 3.5) p + geom_y_margin_point(yintercept = c(18, 28, 15)) p + geom_x_margin_point(data = data.frame(x = c(2.5, 4.5)), mapping = aes(xintercept = x)) diff --git a/tests/testthat/_snaps/position-nudge/nudge-line1.svg b/tests/testthat/_snaps/position-nudge/nudge-line1.svg index a8bb963..c5445f8 100644 --- a/tests/testthat/_snaps/position-nudge/nudge-line1.svg +++ b/tests/testthat/_snaps/position-nudge/nudge-line1.svg @@ -68,8 +68,8 @@ q r s -t -u +t +u diff --git a/tests/testthat/_snaps/position-nudge/nudge-line2.svg b/tests/testthat/_snaps/position-nudge/nudge-line2.svg index bf4d400..6ec5ddc 100644 --- a/tests/testthat/_snaps/position-nudge/nudge-line2.svg +++ b/tests/testthat/_snaps/position-nudge/nudge-line2.svg @@ -27,7 +27,7 @@ - + @@ -47,7 +47,7 @@ - + a b @@ -57,7 +57,7 @@ f g h -i +i j k l diff --git a/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-flt-08.svg b/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-flt-08.svg index ca3c1fe..a4cf652 100644 --- a/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-flt-08.svg +++ b/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-flt-08.svg @@ -2184,6 +2184,7 @@ + @@ -2226,7 +2227,6 @@ - diff --git a/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-flt-09.svg b/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-flt-09.svg index 18829b6..9c1b076 100644 --- a/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-flt-09.svg +++ b/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-flt-09.svg @@ -2184,6 +2184,7 @@ + @@ -2226,7 +2227,6 @@ - diff --git a/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-lbl-x08.svg b/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-lbl-x08.svg index 6bfdeca..3fe6429 100644 --- a/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-lbl-x08.svg +++ b/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-lbl-x08.svg @@ -2184,6 +2184,7 @@ plejzt vtvdjt flrvkp +kuukbh xqvtcy lhazxs erlipd @@ -2226,7 +2227,6 @@ mlyywx fvqmsn yfrmda -qjqfqd diff --git a/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-lbl-x09.svg b/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-lbl-x09.svg index 4b1fbff..254a0db 100644 --- a/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-lbl-x09.svg +++ b/tests/testthat/_snaps/stat-d1d-flt/stat-d1d-lbl-x09.svg @@ -2184,6 +2184,7 @@ plejzt vtvdjt flrvkp +kuukbh xqvtcy lhazxs erlipd @@ -2226,7 +2227,6 @@ mlyywx fvqmsn yfrmda -qjqfqd njtxog wklwhk affxwl