This function encapsulates all the colors that are used in the
forestplot
function. As there are plenty of color
options this function gathers them all in one place.
fpColors(all.elements, box = "black", lines = "gray",
summary = "black", zero = "lightgray", text = "black",
axes = "black", hrz_lines = "black")
A color for all the elements. If set to NULL then it's set to the par("fg") color
The color of the box indicating the estimate
The color of the confidence lines
The color of the summary
The color of the zero line
The color of the text
The color of the x-axis at the bottom
The color of the horizontal lines
list A list with the elements:
the color of the box/marker
the color of the lines
the color of the summary
the color of the zero vertical line
the color of the text
the color of the axes
If you have several values per row in a forestplot you can set
a color to a vector where the first value represents the first
line/box, second the second line/box etc. The vectors are only
valid for the box
\& lines
options.
This function is a copy of the meta.colors
function in the rmeta package.
Other forestplot functions: forestplot
,
fpDrawNormalCI
, fpLegend
# NOT RUN {
ask <- par(ask=TRUE)
# An example of how the exponential works
test_data <- data.frame(coef=c(2.45, 0.43),
low=c(1.5, 0.25),
high=c(4, 0.75),
boxsize=c(0.5, 0.5))
row_names <- cbind(c("Name", "Variable A", "Variable B"),
c("HR", test_data$coef))
test_data <- rbind(rep(NA, 3), test_data)
forestplot(labeltext = row_names,
test_data[,c("coef", "low", "high")],
is.summary=c(TRUE, FALSE, FALSE),
boxsize = test_data$boxsize,
zero = 1,
xlog = TRUE,
col = fpColors(lines="#990000", box="#660000", zero = "darkblue"),
new_page = TRUE)
par(ask=ask)
# }
Run the code above in your browser using DataLab