Skip to content

Commit

Permalink
plot_trajectoryX() looses arg 'value' for consistency with X API (#231)
Browse files Browse the repository at this point in the history
`plot_trajectoryX()` looses the argument 'value' for consistency with X API

This is the opposite of what we discussed with Monika in our meeting, but
it makes makes more sense. When we discussed we didn't notice that the
X (thin) API does not have `main` or `value` -- only the Y (thick) API.
This is consistent with A/B testing two extreemes: thin and thick.
  • Loading branch information
Mauro Lepore authored Jun 8, 2021
1 parent a6bb400 commit 2519067
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
11 changes: 7 additions & 4 deletions R/plot_trajectoryX.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#' * The structure must be like [market_share].
#' * The following columns must have a single value: `sector`, `technology`,
#' `region`, `scenario_source`.
#' @param main String of length 1. `metric` value to plot most prominently, as
#' the main trajectory line.
#' @inheritParams prep_trajectoryY
#' @inheritParams prep_timelineY
#'
Expand All @@ -26,8 +24,13 @@
#' region == "global",
#' scenario_source == "demo_2020"
#' )
#' plot_trajectoryX(data, main = "projected")
plot_trajectoryX <- function(data, main = "projected", normalize = TRUE) {
#' plot_trajectoryX(data)
#'
#' plot_trajectoryX(data, normalize = FALSE)
plot_trajectoryX <- function(data, normalize = TRUE) {
stopifnot("projected" %in% tolower(data$metric))
main <- "projected"

prep <- prep_trajectoryB(data, normalize = normalize)

# FIXME: Make it work with values exposed to the user. Now it's not the case.
Expand Down
9 changes: 4 additions & 5 deletions man/plot_trajectoryX.Rd

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

2 changes: 1 addition & 1 deletion tests/testthat/test-plot_trajectoryX.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ test_that("outputs a ggplot", {
scenario_source == "demo_2020"
)

p <- plot_trajectoryX(data, main = "projected", normalize = TRUE)
p <- plot_trajectoryX(data, normalize = TRUE)
expect_s3_class(p, "ggplot")
})

0 comments on commit 2519067

Please sign in to comment.