Learn R Programming

forestplot (version 3.1.3)

fpShapesGp: A function for graphical parameters of the shapes used in forestplot()

Description

This function encapsulates all the non-text elements that are used in the forestplot() function. As there are plenty of shapes options this function gathers them all in one place.

Usage

fpShapesGp(
  default = NULL,
  box = NULL,
  lines = NULL,
  vertices = NULL,
  summary = NULL,
  zero = NULL,
  axes = NULL,
  hrz_lines = NULL,
  vrtcl_lines = NULL,
  grid = NULL
)

Value

list A list with the elements:

  • default: the gpar for default attributes

  • box: the gpar or list of gpars of the box/marker

  • lines: the gpar or list of gpars of the lines

  • vertices: the gpar or list of gpars of the vertices

  • summary: the gpar or list of gpars of the summary

  • zero: the gpar of the zero vertical line

  • axes: the gpar of the x-axis

  • hrz_lines: the gpar of the horizontal lines

  • grid: the gpar or list of gpars of the grid lines

Arguments

default

A fallback grid::gpar for all unspecified attributes. If set to NULL then it defaults to legacy parameters, including the col, lwd.xaxis, lwd.ci and lty.ci parameter of fpColors.

box

The graphical parameters (gpar, character) of the box, circle or point indicating the point estimate, i.e. the middle of the confidence interval (may be a list of gpars). If provided a string a gpar will be generated with col, and fill for those arguments.

lines

The graphical parameters (gpar, character) of the confidence lines (may be a list of gpars). If provided a string a gpar will be generated with col as the only arguments.

vertices

The graphical parameters (gpar, character) of the vertices (may be a list of gpars). If ci.vertices is set to TRUE in forestplot vertices inherits from lines all its parameters but lty that is set to "solid" by default.

summary

The graphical parameters (gpar, character) of the summary (may be a list of gpars). If provided a string a gpar will be generated with col, and fill for those arguments.

zero

The graphical parameters (gpar) of the zero line (may not be a list of gpars). If provided a string a gpar will be generated with col as the only arguments.

axes

The graphical parameters (gpar) of the x-axis at the bottom (may not be a list of gpars).

hrz_lines

The graphical parameters (gpar) of the horizontal lines (may not be a list of gpars). If provided a string a gpar will be generated with col as the only arguments.

vrtcl_lines

The graphical parameters (gpar) of the vertical lines (may not be a list of gpars). If provided a string a gpar will be generated with col as the only arguments.

grid

The graphical parameters (gpar) of the grid (vertical lines) (may be a list of gpars). If provided a string a gpar will be generated with col as the only arguments.

Author

Andre GILLIBERT

Details

This function obsoletes fpColors().

If some, but not all parameters of a shape (e.g. box) are specified in gpar() such as setting lwd but not line color, the unspecified parameters default to the ones specified in default, then, default to legacy parameters of forestplot such as col.

Parameters box, lines, vertices, summary may be set as list containing several gpars. The length of the list must either be equal to the number of bands per label or to the number of bands multiplied by the number of labels, allowing specification of different styles for different parts of the forest plot.

The parameter grid can either be a single gpar or a list of gpars with as many elements as there are lines in the grid (as set by the xticks or grid arguments of forestplot)

Parameters zero, axes, hrz_lines must either be NULL or gpar but cannot be lists of gpars.

See Also

Other forestplot functions: forestplot(), fpColors(), fpDrawNormalCI(), fpLegend(), fp_add_lines(), fp_decorate_graph(), fp_insert_row(), fp_set_style(), fp_set_zebra_style()

Examples

Run this code
ask <- par(ask = TRUE)

# An example of how fpShapesGp works

styles <- fpShapesGp(
  default = gpar(col = "pink", lwd = 2, lineend = "square", linejoin = "mitre"),
  grid = list(
    gpar(col = "blue"),
    gpar(col = "black"),
    gpar(col = "blue")
  ),
  box = list(
    gpar(fill = "black"),
    gpar(fill = "blue"),
    gpar(fill = "black"),
    gpar(fill = "blue")
  ),
  lines = gpar(lty = "dashed"),
  vertices = gpar(lwd = 5, col = "red")
)

forestplot(
  labeltext = c("Author1", "Author2", "Author3", "Author4"),
  grid = c(1, 3, 5),
  mean = 1:4, lower = 0:3, upper = 2:5,
  shapes_gp = styles
)

par(ask = ask)

Run the code above in your browser using DataLab