Skip to content

Commit

Permalink
Add examples back in for interval plots and quantile plots previously…
Browse files Browse the repository at this point in the history
… failing due to changes in `add_coverage()`
  • Loading branch information
nikosbosse committed Nov 18, 2023
1 parent 4df4576 commit 8bd44e0
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 32 deletions.
33 changes: 17 additions & 16 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,16 @@ plot_wis <- function(scores,
#' @export
#' @examples
#' library(ggplot2)
#' # scores <- score(example_quantile)
#' # scores <- summarise_scores(scores, by = c("model", "target_type", "range"))
#'
#' # plot_ranges(scores, x = "model") +
#' # facet_wrap(~target_type, scales = "free")
#'
#' # visualise dispersion instead of interval score
#' # plot_ranges(scores, y = "dispersion", x = "model") +
#' # facet_wrap(~target_type)
#' ex <- example_quantile
#' ex$interval_range <- get_range_from_quantile(ex$quantile)
#' scores <- score(ex, metrics = list("wis" = wis))
#' scores$range <- scores$interval_range
#' summarised <- summarise_scores(
#' scores,
#' by = c("model", "target_type", "range")
#' )
#' plot_ranges(summarised, x = "model") +
#' facet_wrap(~target_type, scales = "free")

plot_ranges <- function(scores,
y = "wis",
Expand Down Expand Up @@ -582,10 +583,10 @@ make_na <- make_NA
#' @importFrom data.table dcast
#' @export
#' @examples
#' # data.table::setDTthreads(1) # only needed to avoid issues on CRAN
#' # scores <- score(example_quantile)
#' # scores <- summarise_scores(scores, by = c("model", "range"))
#' # plot_interval_coverage(scores)
#' data.table::setDTthreads(1) # only needed to avoid issues on CRAN
#' data_coverage <- add_coverage(example_quantile)
#' summarised <- summarise_scores(data_coverage, by = c("model", "range"))
#' plot_interval_coverage(summarised)

plot_interval_coverage <- function(scores,
colour = "model") {
Expand Down Expand Up @@ -638,9 +639,9 @@ plot_interval_coverage <- function(scores,
#' @importFrom data.table dcast
#' @export
#' @examples
#' # scores <- score(example_quantile)
#' # scores <- summarise_scores(scores, by = c("model", "quantile"))
#' # plot_quantile_coverage(scores)
#' data_coverage <- add_coverage(example_quantile)
#' summarised <- summarise_scores(data_coverage, by = c("model", "quantile"))
#' plot_quantile_coverage(summarised)

plot_quantile_coverage <- function(scores,
colour = "model") {
Expand Down
8 changes: 4 additions & 4 deletions man/plot_interval_coverage.Rd

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

6 changes: 3 additions & 3 deletions man/plot_quantile_coverage.Rd

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

19 changes: 10 additions & 9 deletions man/plot_ranges.Rd

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

0 comments on commit 8bd44e0

Please sign in to comment.