The intention of this vignette is to show how to plot different styles of cost-effectiveness acceptability curves using the BCEA package.
To calculate these in BCEA we use the bcea()
function.
The plot defaults to base R plotting. Type of plot can be set
explicitly using the graph
argument.
Other plotting arguments can be specified such as title, line colours and theme.
ceplane.plot(he,
graph = "ggplot2",
title = "my title",
line = list(color = "green", size = 3),
point = list(color = "blue", shape = 10, size = 5),
icer = list(color = "orange", size = 5),
area = list(fill = "grey"),
theme = theme_linedraw())
If you only what the mean point then you can suppress the sample
points by passing size NA
.
This situation is when there are more than two interventions to consider.
Basic plots with defaults.
The font size can be adjusted using the text
argument.
# equivalent but more flexible and direct
ceplane.plot(he, graph = "ggplot2") +
theme(axis.text = element_text(size = 18),
axis.title.x = element_text(size = 20),
axis.title.y = element_text(size = 20))
Numerous different styling arguments can be provided.
ceplane.plot(he,
graph = "ggplot2",
title = "my title",
line = list(color = "red", size = 1),
point = list(color = c("plum", "tomato", "springgreen"), shape = 3:5, size = 2),
icer = list(color = c("red", "orange", "black"), size = 5))
There are various different ways to reposition the legend.
For {ggplot2}
we can modify the willingness-to-pay label
e.g. “k = 25000”.
The default is
The simplest argument is to set the value of the willingness-to-pay
threshold using wtp
.
Alternatively, we can pass a list of arguments to wtp
to
modify the appearance of the label.
To hide the text assign size = 0
.
The label is placed at the left hand side of the plot next to the willingness-to-pay line by default. When this would mean the label is off the bottom of the plot it is positioned at the bottom left corner.
The position of the label can be adjusted using the
label.pos
argument and a logical value.
A direct way of specifying the position of the label is to use the
wtp
argument and set the y
value in a
list.
For base R
##TODO: not yet implemented ggplot syntax for base R
# ceplane.plot(he, wtp = list(value = 10000))
# ceplane.plot(he, wtp = list(value = 10000, colour = "blue"))
# ceplane.plot(he, wtp = list(colour = "blue"))
# ceplane.plot(he, wtp = list(y = 8))
# ceplane.plot(he, wtp = list(size = 5))
#
# # to hide text
# ceplane.plot(he, wtp = list(size = 0))