Skip to content

Commit

Permalink
Fix ggplot2 warnings in examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Dec 15, 2023
1 parent cec7a17 commit 9a7ef99
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
14 changes: 7 additions & 7 deletions R/ggplot-geom_bbands.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
#' geom_line() + # Plot stock price
#' geom_bbands(aes(high = high, low = low, close = close), ma_fun = SMA, n = 50) +
#' coord_x_date(xlim = c(as_date("2016-12-31") - dyears(1), as_date("2016-12-31")),
#' ylim = c(75, 125))
#' ylim = c(20, 35))
#'
#'
#' # EMA
Expand All @@ -87,7 +87,7 @@
#' geom_bbands(aes(high = high, low = low, close = close),
#' ma_fun = EMA, wilder = TRUE, ratio = NULL, n = 50) +
#' coord_x_date(xlim = c(as_date("2016-12-31") - dyears(1), as_date("2016-12-31")),
#' ylim = c(75, 125))
#' ylim = c(20, 35))
#'
#'
#' # VWMA
Expand All @@ -97,7 +97,7 @@
#' geom_bbands(aes(high = high, low = low, close = close, volume = volume),
#' ma_fun = VWMA, n = 50) +
#' coord_x_date(xlim = c(as_date("2016-12-31") - dyears(1), as_date("2016-12-31")),
#' ylim = c(75, 125))
#' ylim = c(20, 35))


#' @rdname geom_bbands
Expand Down Expand Up @@ -166,7 +166,7 @@ geom_bbands_ <- function(mapping = NULL, data = NULL,

StatBBandsRibbon <- ggplot2::ggproto("StatBBandsRibbon", ggplot2::Stat,
required_aes = c("x", "high", "low", "close"),

dropped_aes = c("high", "low", "close", "y"),
compute_group = function(data, scales, params,
n = 10, ma_fun = SMA, sd = 2,
wilder = FALSE, ratio = NULL,
Expand All @@ -192,7 +192,7 @@ StatBBandsRibbon <- ggplot2::ggproto("StatBBandsRibbon", ggplot2::Stat,

StatBBandsMA <- ggplot2::ggproto("StatBBandsMA", ggplot2::Stat,
required_aes = c("x", "high", "low", "close"),

dropped_aes = c("high", "low", "close", "y"),
compute_group = function(data, scales, params,
ma_fun = "SMA", n = 20, sd = 2,
wilder = FALSE, ratio = NULL,
Expand All @@ -217,7 +217,7 @@ StatBBandsMA <- ggplot2::ggproto("StatBBandsMA", ggplot2::Stat,

StatBBandsRibbon_vol <- ggplot2::ggproto("StatBBandsRibbon", ggplot2::Stat,
required_aes = c("x", "high", "low", "close", "volume"),

dropped_aes = c("high", "low", "close", "volume", "y"),
compute_group = function(data, scales, params,
ma_fun = "SMA", n = 10, sd = 2,
wilder = FALSE, ratio = NULL,
Expand All @@ -244,7 +244,7 @@ StatBBandsRibbon_vol <- ggplot2::ggproto("StatBBandsRibbon", ggplot2::Stat,

StatBBandsMA_vol <- ggplot2::ggproto("StatBBandsMA", ggplot2::Stat,
required_aes = c("x", "high", "low", "close", "volume"),

dropped_aes = c("high", "low", "close", "volume", "y"),
compute_group = function(data, scales, params,
n = 20, ma_fun = SMA, sd = 2,
wilder = FALSE, ratio = NULL,
Expand Down
12 changes: 6 additions & 6 deletions R/ggplot-geom_chart.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@
#' geom_barchart(aes(open = open, high = high, low = low, close = close)) +
#' geom_ma(color = "darkgreen") +
#' coord_x_date(xlim = c("2016-01-01", "2016-12-31"),
#' ylim = c(75, 125))
#' ylim = c(20, 30))
#'
#' # Candlestick Chart
#' AAPL %>%
#' ggplot(aes(x = date, y = close)) +
#' geom_candlestick(aes(open = open, high = high, low = low, close = close)) +
#' geom_ma(color = "darkgreen") +
#' coord_x_date(xlim = c("2016-01-01", "2016-12-31"),
#' ylim = c(75, 125))
#' ylim = c(20, 30))

# Bar Chart -----

Expand Down Expand Up @@ -105,7 +105,7 @@ geom_barchart <- function(mapping = NULL, data = NULL, stat = "identity",

StatLinerangeBC <- ggplot2::ggproto("StatLinerangeBC", ggplot2::Stat,
required_aes = c("x", "open", "high", "low", "close"),

dropped_aes = c("open", "high", "low", "close", "y"),
compute_group = function(data, scales, params,
fill_up, fill_down,
colour_up, colour_down) {
Expand All @@ -122,7 +122,7 @@ StatLinerangeBC <- ggplot2::ggproto("StatLinerangeBC", ggplot2::Stat,

StatSegmentLeftBC <- ggplot2::ggproto("StatSegmentLeftBC", ggplot2::Stat,
required_aes = c("x", "open", "high", "low", "close"),

dropped_aes = c("open", "high", "low", "close"),
compute_group = function(data, scales, params,
fill_up, fill_down,
colour_up, colour_down) {
Expand All @@ -141,7 +141,7 @@ StatSegmentLeftBC <- ggplot2::ggproto("StatSegmentLeftBC", ggplot2::Stat,

StatSegmentRightBC <- ggplot2::ggproto("StatSegmentRightBC", ggplot2::Stat,
required_aes = c("x", "open", "high", "low", "close"),

dropped_aes = c("open", "high", "low", "close"),
compute_group = function(data, scales, params,
fill_up, fill_down,
colour_up, colour_down) {
Expand Down Expand Up @@ -204,7 +204,7 @@ geom_candlestick <- function(mapping = NULL, data = NULL, stat = "identity",

StatRectCS <- ggplot2::ggproto("StatRectCS", ggplot2::Stat,
required_aes = c("x", "open", "high", "low", "close"),

dropped_aes = c("open", "high", "low", "close", "x", "y"),
compute_group = function(data, scales, params,
fill_up, fill_down,
colour_up, colour_down) {
Expand Down
2 changes: 1 addition & 1 deletion R/ggplot-theme_tq.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#' ratio = NULL,
#' n = 50) +
#' coord_x_date(xlim = c("2016-01-01", "2016-12-31"),
#' ylim = c(75, 125)) +
#' ylim = c(20, 35)) +
#' labs(title = "Apple BBands",
#' x = "Date",
#' y = "Price") +
Expand Down
8 changes: 4 additions & 4 deletions man/geom_bbands.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/geom_chart.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/geom_ma.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/theme_tq.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9a7ef99

Please sign in to comment.