Skip to content

Commit

Permalink
Sgg$ggtitle() = Sgg$title()
Browse files Browse the repository at this point in the history
  • Loading branch information
phgrosjean committed Sep 20, 2023
1 parent 018eff9 commit cd2a8d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 3 additions & 2 deletions R/Sgg.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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_")),
Expand Down Expand Up @@ -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)))
Expand Down

0 comments on commit cd2a8d8

Please sign in to comment.