Skip to content

Commit

Permalink
Merge pull request #59 from n8thangreen/dev
Browse files Browse the repository at this point in the history
bug fix plot
  • Loading branch information
giabaio authored Jan 25, 2024
2 parents f781581 + cbce0fa commit 6edcff0
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 29 deletions.
8 changes: 4 additions & 4 deletions R/ceac_plot_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ ceac_ggplot <- function(he,
graph_params <- helper_ggplot_params(he, graph_params)
legend_params <- make_legend_ggplot(he, pos_legend)
theme_add <- purrr::keep(extra_params, is.theme)

ggplot(data_psa, aes(x = .data$k, y = .data$ceac)) +
geom_line(aes(linetype = .data$comparison,
linewidth = factor(.data$comparison),
Expand All @@ -151,9 +151,9 @@ ceac_ggplot <- function(he,
scale_color_manual("",
labels = graph_params$labels,
values = graph_params$line$color) +
scale_size_manual("",
labels = graph_params$labels,
values = graph_params$line$size)
scale_linewidth_manual("",
labels = graph_params$labels,
values = graph_params$line$size)
}


Expand Down
2 changes: 1 addition & 1 deletion man-roxygen/args-comparison.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @param comparison Selects the comparator, in case of more than two
#' interventions being analysed. Default as NULL plots all the comparisons
#' together. Any subset of the possible comparisons can be selected (e.g.,
#' \code{comparison=c(1,3)} or \code{comparison=2}).
#' `comparison=c(1,3)` or `comparison=2`).

6 changes: 3 additions & 3 deletions man-roxygen/args-graph.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' @param graph A string used to select the graphical engine to use for
#' plotting. Should (partial-)match the three options \code{"base"},
#' \code{"ggplot2"} or \code{"plotly"}. Default value is \code{"base"}.
#' Not all plotting functions have a \code{"plotly"} implementation yet.
#' plotting. Should (partial-)match the three options `"base"`,
#' `"ggplot2"` or `"plotly"`. Default value is `"base"`.
#' Not all plotting functions have a `"plotly"` implementation yet.
2 changes: 1 addition & 1 deletion man-roxygen/args-he.R
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#' @param he A \code{bcea} object containing the results of the Bayesian
#' @param he A `bcea` object containing the results of the Bayesian
#' modelling and the economic evaluation.
8 changes: 4 additions & 4 deletions man-roxygen/args-pos.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#' @param pos Parameter to set the position of the legend (only relevant for
#' multiple interventions, ie more than 2 interventions being compared).
#' Can be given in form
#' of a string \code{(bottom|top)(right|left)} for base graphics and
#' \code{bottom|top|left|right} for ggplot2. It can be a two-elements vector,
#' of a string `(bottom|top)(right|left)` for base graphics and
#' `bottom|top|left|right` for ggplot2. It can be a two-elements vector,
#' which specifies the relative position on the x and y axis respectively, or
#' alternatively it can be in form of a logical variable, with \code{FALSE}
#' indicating to use the default position and \code{TRUE} to place it on the
#' alternatively it can be in form of a logical variable, with `FALSE`
#' indicating to use the default position and `TRUE` to place it on the
#' bottom of the plot.

10 changes: 5 additions & 5 deletions tests/testthat/test-bcea.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

test_that("input errors", {

load(test_path("ce.RData"))
load(test_path("testdata/ce.RData"))

expect_dims_error <- function(x, y) {
expect_error(
Expand Down Expand Up @@ -60,7 +60,7 @@ test_that("input errors", {

test_that("basic return", {

load(test_path("ce.RData"))
load(test_path("testdata", "ce.RData"))

res <-
bcea(e = eff,
Expand Down Expand Up @@ -187,7 +187,7 @@ test_that("jags, bugs, stan methods", {

test_that("k and wtp arguments", {

load(test_path("ce.RData"))
load(test_path("testdata", "ce.RData"))

m <- bcea(eff, cost, plot = FALSE)

Expand All @@ -205,7 +205,7 @@ test_that("k and wtp arguments", {

test_that("using e and c still works", {

load(test_path("ce.RData"))
load(test_path("testdata", "ce.RData"))

e <- eff
c <- cost
Expand All @@ -218,7 +218,7 @@ test_that("using e and c still works", {

test_that("named reference", {

load(test_path("ce.RData"))
load(test_path("testdata", "ce.RData"))

expect_equal(bcea(eff, cost, ref = 1, interventions = c("a", "b")),
bcea(eff, cost, ref = "a", interventions = c("a", "b")))
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-bcea_setters.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

test_that("setKmax", {

load(test_path("ce.RData"))
load(test_path("testdata", "ce.RData"))

m <- bcea(e = eff,
c = cost,
Expand All @@ -23,7 +23,7 @@ test_that("setKmax", {

test_that("setReferenceGroup", {

load(test_path("ce.RData"))
load(test_path("testdata", "ce.RData"))

m <- bcea(e = eff,
c = cost,
Expand All @@ -40,7 +40,7 @@ test_that("setReferenceGroup", {

test_that("setComparison", {

load(test_path("ce.RData"))
load(test_path("testdata", "ce.RData"))

m_r1 <- bcea(e = eff,
c = cost,
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-ceac_plot_ggplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# library(purrr)

test_that("ceac.plot_ggplot draws correctly", {
load("ce.RData")
load(test_path("testdata", "ce.RData"))

he <- BCEA::bcea(eff, cost)

ceac_plot <- ceac.plot(he, graph = "ggplot2", title = "my title")
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-compute_U.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

test_that("compute_U", {

load(test_path("ce.RData"))
load(test_path("testdata", "ce.RData"))

# single wtp

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-compute_ol.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

test_that("simple data input parameters", {

load(test_path("ce.RData"))
load(test_path("testdata", "ce.RData"))

# only one intervention
# limiting case
Expand Down Expand Up @@ -66,7 +66,7 @@ test_that("simple data input parameters", {

test_that("call via bcea", {

load(test_path("ce.RData"))
load(test_path("testdata", "ce.RData"))

res <-
bcea(e = eff,
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-compute_vi.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

test_that("simple data", {

load(test_path("ce.RData"))
load(test_path("testdata", "ce.RData"))

# only one intervention
# limiting case
Expand Down Expand Up @@ -50,7 +50,7 @@ test_that("simple data", {

test_that("call via bcea", {

load(test_path("ce.RData"))
load(test_path("testdata", "ce.RData"))

res <-
bcea(e = eff,
Expand Down Expand Up @@ -86,7 +86,7 @@ test_that("errors in dimensions", {

test_that("using sim_table", {

load(test_path("ce.RData"))
load(test_path("testdata", "ce.RData"))

res <-
bcea(e = eff,
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-eib_plot_ggplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@


test_that("eib.plot_ggplot draws correctly", {
load("ce.RData")
load(test_path("testdata", "ce.RData"))

he <- BCEA::bcea(eff, cost)

eib_plot <- eib.plot(he, graph = "ggplot2", title = "my title")
Expand Down
File renamed without changes.

0 comments on commit 6edcff0

Please sign in to comment.