dfWide2segments | R Documentation |
Convert data.frame to plotly line segment format
dfWide2segments(x, axes1, axes2, ...)
x |
numeric matrix of coordinates, where x,y,z coordinates are
present twice per row, and whose colnames are defined by
|
axes1 |
vector of colnames(x) corresponding to the x,y,z coordinates of the first point in a line segment. It can be of any length, but is intended for length 2 or 3. |
axes2 |
vector of colnames(x) corresponding to the x,y,z coordinates
of the second point in a line segment. It must be the same length as
|
... |
additional parameters are ignored. |
Purpose is to take a data.frame containing (x,y) or (x,y,z) coordinates for two points defined on one row, and create a data.frame with 3 rows where blank coordinates are used to separate each line segment. The main benefit in using this function is that it enables vectorized line segment drawing when used with a plotting function that recognizes line breaks via empty rows, for example plotly.
data.frame where every two rows represents a line segment to be drawn by plotly, followed by a blank line indicating the line ends.
Other jam spatial functions:
bgaPlotly3d()
,
compressPolygonM()
,
simplifyXY()
,
spline3d()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.