draw_panels: Draw coefficient stability plots.

Description Usage Arguments Value

View source: R/create_stability_plot.R

Description

draw_panels is the fifth and final step of a starbility plot, following create_plot_dfs. It is generally called directly by stability_plot, but the user can also call it manually.

Usage

1
draw_panels(coef_grid., control_grid., ...)

Arguments

coef_grid

A dataframe generated by create_grid (first element of returned list), or a data frame of the same structure.

control_grid

A dataframe generated by create_grid (second element of returned list), or a data frame of the same structure.

point_size

A numeric scalar indicating the size of the points indicating coefficient estimates. Defaults to 1.

error_geom

A string indicating the type of geom that should be used to indicate confidence intervals on coefficient estimates. Currently supported are ribbon, errorbar, and none. Defaults to errorbar if fewer than 100 models are plotted; defaults to ribbon if 100 or more models are plotted.

error_alpha

A numeric scalar indicating the alpha of the error geom. Defaults to 0.2.

coef_ylim

A numeric vector of length two indicating the minimum and maximum values of the y-axis in the coefficient plot. If not specified, uses ggplot2 default.

coef_ylabel

A string specifying the y-axis label on the coefficient panel. Defaults to 'Coefficient estimate'.

control_geom

A string indicating the geom that should be used to indicate the presence of controls. Currently supported are circle and rect. Defaults to rect.

control_spacing

A string indicating how large the geoms indicating the presence of controls should be. For control_geom=='circle', this is the diameter of the circle. For control_geom=='rect', this is the width of the rectangle. Defaults to 0.75 if fewer than 40 models are displayed; defaults to 1 otherwise.

control_text_size

A numeric scalar indicating how large the control name text should be. Defaults to 9.

rel_height

A numeric scalar indicating the size of the bottom panel (displaying presence of controls) relative to the top panel (displaying presence of coefficients). Defaults to 0.25.

trim_top

A numeric scalar indicating how close the bottom panel (displaying presence of controls) should be to the top panel (displaying presence of coefficients). Useful when dealing with large CIs.

combine

A logical scalar. Return the panels combined as a single object, or return a list containing the two panels separately?

Value

If combine=T (default) a cowplot grid with both panels. If combine=F, a list containing two 'ggplot2“ objects: one corresponding to the coefficient panel and one corresponding to the control panel.


AakaashRao/starbility documentation built on May 21, 2020, 9:49 a.m.