Skip to contents

Adds a budget line to a data frame. The budget lines are accumulated in rows.

Usage

add_budget_line(
  .DF = NULL,
  meta,
  graph_type = ReboundTools::graph_types$consumption,
  line_name,
  colour = ReboundTools::path_graph_params$cons_grid_colour,
  linewidth = ReboundTools::path_graph_params$cons_grid_linewidth,
  linetype = ReboundTools::path_graph_params$cons_grid_linetype,
  slope,
  intercept,
  graph_df_colnames = ReboundTools::graph_df_colnames
)

Arguments

.DF

The data frame to which lines are appended. When NULL, the default, a new data frame is created and returned. When not NULL, rows for the budget lines are added to the bottom of .DF.

meta

A data frame of metadata for the segment to be added. This metadata data frame provides the left-most columns of the return value.

graph_type

The type of graph associated with this segment. Default is See ReboundTools::graph_types$consumption.

line_name

A name for this budget line

colour

The colour for this budget line. Default is ReboundTools::path_graph_params$cons_grid_colour.

linewidth

The size (width) for this budget line. Default is ReboundTools::path_graph_params$cons_grid_linewidth.

linetype

The line type for this budget line. Default is ReboundTools::path_graph_params$cons_grid_linetype.

slope

The slope of this budget line.

intercept

The intercept of this budget line.

graph_df_colnames

A list of column names in graph data frames. Default is ReboundTools::graph_df_colnames.

Value

A version of .DF with budget lines added at the bottom.

Details

There is usually no need to call this function directly. Functions like iso_budget_lines_cons() add_iso() call add_budget_line() internally.

Examples

meta <- tibble::tibble(Case = "Test case")
add_budget_line(meta = meta, 
  line_name = "Test budget line", 
  slope = -1, intercept = 5)
#> # A tibble: 1 × 8
#>   Case      graph_type  line_name      colour linewidth linetype slope intercept
#>   <chr>     <chr>       <chr>          <chr>      <dbl> <chr>    <dbl>     <dbl>
#> 1 Test case Consumption Test budget l… black        0.1 solid       -1         5