Add a line segment to a data frame
add_segment.Rd
Adds a line segment to a data frame of line segments. The line segments are accumulated in rows.
Usage
add_segment(
.DF = NULL,
indexed,
meta,
graph_type,
segment_name,
colour = "black",
linewidth = 1,
linetype = "solid",
x_orig,
y_orig,
x,
y,
xend,
yend,
graph_df_colnames = ReboundTools::graph_df_colnames
)
Arguments
- .DF
A data frame that accumulates line segments. When
NULL
, the default, a new data frame is created and returned. When notNULL
, rows for the segment are added to the bottom of.DF
.- indexed
A boolean telling whether the rebound path should be indexed to
1
at its start.- 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. See
ReboundTools::graph_types
.- segment_name
A name for this segment.
- colour
The colour for this segment. Default is "black".
- linewidth
The line width for this segment. Default is
1
.- linetype
The line type for this segment. Default is "solid".
- x_orig, y_orig
The (x,y) coordinates of the starting point for this path, used for indexing.
- x, y
The (x,y) coordinates of the starting point for this segment of the path.
- xend, yend
The (x,y) coordinates of the ending point for this segment of the path.
- graph_df_colnames
A list of column names to use throughout the package. Default is
ReboundTools::graph_df_colnames
.
Details
There is usually no need to call this function directly.
Functions like energy_paths()
call add_segment()
internally.
Examples
meta <- tibble::tibble(Case = "Test case")
add_segment(indexed = FALSE, meta = meta, graph_type = "Test type",
segment_name = "Test segment",
x_orig = 10, y_orig = 10,
x = 20, y = 30, xend = 40, yend = 50)
#> # A tibble: 1 × 10
#> Case graph_type line_name colour linewidth linetype x y xend yend
#> <chr> <chr> <chr> <chr> <dbl> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 Test c… Test type Test seg… black 1 solid 20 30 40 50