Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

## Bug fixes

- `plot.psa(center = FALSE)` no longer warns "No shared levels found between `names(values)` of the manual scale and the data's fill values" when it is drawn. The fill scale is now added only when the center points that use it are.
- `plot.owsa(col = "bw")` now draws each strategy with its own line type; all strategies used to share one line type and could not be told apart (#176).
- `metamodel()` now names invalid parameters in its error message, including when called through `calc_evppi()` and `calc_evsi()` (#177).
- `gen_psa_samp()` now accepts the documented `"value, weight"` parameterization for `"bootstrap"` distributions. It used to be dropped silently, which shifted the parameterization of every later parameter by one position. **Samples from calls with a bootstrap parameter before other parameters will differ, because they are now correct.** Unknown distributions or parameterizations, and `params`, `dists`, `parameterization_types`, and `dists_params` of different lengths, now give informative errors instead of being dropped silently (#175).
Expand Down
8 changes: 6 additions & 2 deletions R/psa.R
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ plot.psa <- function(x,

# add common theme
col <- match.arg(col)
add_common_aes(psa_plot, txtsize, col = col, col_aes = c("color", "fill"),
# only the center points use fill; a fill scale without them makes ggplot2 warn
add_common_aes(psa_plot, txtsize, col = col,
col_aes = if (center) c("color", "fill") else "color",
continuous = c("x", "y"),
n_x_ticks = n_x_ticks, n_y_ticks = n_y_ticks,
xbreaks = xbreaks, ybreaks = ybreaks,
Expand Down Expand Up @@ -320,7 +322,9 @@ plot.psa <- function(x,

# add common theme
col <- match.arg(col)
add_common_aes(psa_plot, txtsize, col = col, col_aes = c("color", "fill"),
# only the center points use fill; a fill scale without them makes ggplot2 warn
add_common_aes(psa_plot, txtsize, col = col,
col_aes = if (center) c("color", "fill") else "color",
continuous = c("x", "y"),
n_x_ticks = n_x_ticks, n_y_ticks = n_y_ticks,
xbreaks = xbreaks, ybreaks = ybreaks,
Expand Down
13 changes: 13 additions & 0 deletions tests/testthat/test_plot_options.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ test_that("plot.psa(ref_str = ): reference axes and caption are optional", {
expect_setequal(as.character(unique(ggplot2::layer_data(p2, 1)$group)), c("1", "2"))
})

test_that("plot.psa() without center points builds without a fill-scale warning", {
# both the plain and the incremental CE plane, in every color option
for (col in c("access", "full", "bw")) {
expect_no_warning(ggplot2::ggplot_build(plot(psa_big, center = FALSE, ellipse = FALSE, col = col)))
expect_no_warning(ggplot2::ggplot_build(plot(psa_big, ref_str = "Chemo", center = FALSE,
ellipse = FALSE, col = col)))
}
# with center points, strategies still get matching color and fill
p <- plot(psa_big)
v_aes <- unlist(lapply(p$scales$scales, function(s) s$aesthetics))
expect_true(all(c("colour", "fill") %in% v_aes))
})

test_that("plot.ceac(): frontier, points, and min_prob", {
df_ceac <- ceac(v_wtp, psa_big)
expect_true("GeomPoint" %in% geoms(plot(df_ceac)))
Expand Down
Loading