From cd2a8d8bc103a0eace6417cc3d4937a37567a7af Mon Sep 17 00:00:00 2001 From: phgrosjean Date: Wed, 20 Sep 2023 11:25:19 +0200 Subject: [PATCH] Sgg$ggtitle() = Sgg$title() --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ R/Sgg.R | 5 +++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 41c6f56..492c9e9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: chart Type: Package -Version: 1.5.0 +Version: 1.5.1 Title: General Charting (Plotting) Function Description: Chart generalizes plot generation in R, being with base R plot function, lattice or ggplot2. A formula interface is available for both diff --git a/NEWS.md b/NEWS.md index f03e0cb..4b15ef2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# chart 1.5.1 + +- `sgg()` now prefers using `Sgg$ggtitle()`, but `Sgg$title()` is accepted as well. + # chart 1.5.0 - The `gg()` subsettable function is now called `Sgg()` and it implements `svMisc:aka()` and `svMisc::section()` to sort items in different sections. diff --git a/R/Sgg.R b/R/Sgg.R index e719991..67986d5 100644 --- a/R/Sgg.R +++ b/R/Sgg.R @@ -72,6 +72,7 @@ Sgg <- structure(function(ggplot, ...) { #' @rdname Sgg #' @method $ subsettable_Sgg `$.subsettable_Sgg` <- function(x, name) { + # We use ggtitle(), but also allow title() if (name == "title") name <- "ggtitle" if (grepl("o__", name)) { @@ -100,7 +101,7 @@ Sgg <- structure(function(ggplot, ...) { o__GEOMETRIES__ = construct_section("o__GEOMETRIES__", obj, apropos("^geom_")), o__AXES_LABELS__ = construct_section("o__AXES_LABELS__", obj, - c("expand_limits", "guides", "labs", "lims", "title", + c("expand_limits", "guides", "labs", "lims", "ggtitle", "xlab", "xlim", "ylab", "ylim")), o__STATS__ = construct_section("o__STATS__", obj, apropos("^stat_")), @@ -149,7 +150,7 @@ Sgg <- structure(function(ggplot, ...) { l <- c(l, apropos(paste0("^geom_", pattern))) l <- c(l, "o__AXES_LABELS__") l <- c(l, "expand_limits", "guides", "labs", "lims", - "title", # Instead of ggtitle (special case!) + "ggtitle", # No, not any more! Instead of ggtitle (special case!) "xlab", "xlim", "ylab", "ylim") l <- c(l, "o__STATS__") l <- c(l, apropos(paste0("^stat_", pattern)))