Efficiently plot QSMs, point clouds, leaves, and stem triangulation meshes. Plots can be combined and extensively customized.
plot_qsm(
cylinder = NULL,
radius = NULL,
color = NULL,
palette = NULL,
alpha = 1,
facets = 6,
skeleton = FALSE,
skeleton_lwd = 1,
cloud = NULL,
pt_color = "#000000",
pt_palette = NULL,
pt_size = NULL,
pt_alpha = 1,
triangulation = NULL,
tri_color = NULL,
tri_palette = NULL,
tri_alpha = 1,
leaves = NULL,
lf_color = "#5BA803",
lf_alpha = 1,
axes = TRUE,
axes_color = "#000000",
grid = FALSE,
grid_color = "#D3D3D3",
hover = FALSE,
bg_color = "#FFFFFF",
lit = FALSE,
pan = TRUE,
normalize = FALSE,
mesh = NULL
)
An rgl::open3d()
plot
QSM cylinder data frame.
Radius column name either quoted or unquoted. Defaults to the modified radii.
Optional cylinder color parameter.
color
must be a single hex color string, a grDevices::colors()
, a vector
of hex colors, or a quoted/unquoted column name.
Vectors must have the same length as the cylinder data frame.
color = "random"
will generate a random color applied to all cylinders.
Defaults to branching order.
Optional cylinder color palette for numerical data.
Palettes include colourvalues::color_palettes()
or a user supplied RGB
palette matrix with the length of cylinder. It can also be set to "random"
to generate a random palette. If combined with color = "random"
, each
cylinder will have a random, distinct color.
Set the transparency of the cylinders. Defaults to 1. 1 is opaque and 0 is fully transparent.
The number of facets in the polygon cross section. Defaults to 6. A higher number of facets improves visual smoothness at the cost of plotting speed, performance and memory.
Plot the QSM skeleton instead of cylinders. Defaults to FALSE.
Skeleton line width. Defaults to 1.
Point cloud data frame or matrix where the first three columns are the x, y, and z coordinates.
Optional point cloud color parameter.
pt_color
must be a single hex color string, a grDevices::colors()
, a vector
of hex colors, or a quoted/unquoted column name.
pt_color = "random"
will generate a random color for all points.
Vectors must have the same length as the point cloud data frame.
Optional point cloud color palette for numerical data.
pt_palette
includes colourvalues::color_palettes()
or a user supplied RGB
palette matrix with the length of the points. It can also be set to "random"
to generate a random palette. If combined with color = "random"
, each
point will have a random, distinct color.
Size of the points. Defaults to 0.1.
Set the transparency of the point cloud. Defaults to 1. 1 is opaque and 0 is fully transparent.
Stem triangulation mesh from TreeQSM. Defaults to NULL.
Color of the triangulation mesh.
Accepts hex colors, grDevices::colors()
, or "random".
Defaults to rainbow z-axis.
Optional triangulation color palette for z values. Supports the same inputs as palette.
Set the transparency of the triangulation mesh. Defaults to 1. 1 is opaque and 0 is fully transparent.
Leaf mesh in the rgl::mesh3d()
format. Defaults to NULL.
Color of the leaves. Defaults to leaf green.
Accepts hex colors, grDevices::colors()
,"random", or "random_vertex".
lf_color = "random"
assigns a random color to all leaves, while
lf_color = "random_vertex"
which assigns a random color to each vertex.
Set the transparency of the leaves. Defaults to 1. 1 is opaque and 0 is fully transparent.
Show plot axes. Defaults to TRUE.
Set the axes color. Defaults to black.
Show plot grid lines. Defaults to FALSE.
Set grid lines color. Defaults to grey.
Show cylinder and branch id on mouse hover. Defaults to FALSE.
Set the background color of the plot.
Accepts hex colors or grDevices::colors()
. Defaults to white.
Enable light source in plot. Defaults to FALSE.
Use right mouse button to pan the plot. Defaults to TRUE.
Panning is disabled when hover = TRUE
.
Normalize the cylinders to 0,0,0. Defaults to FALSE.
Plot any rgl::mesh3d()
object.
## TreeQSM
file <- system.file("extdata/QSM.mat", package = "rTwig")
qsm <- import_treeqsm(file)
cylinder <- qsm$cylinder
cylinder <- update_cylinders(cylinder)
plot_qsm(cylinder)
triangulation <- qsm$triangulation
plot_qsm(triangulation = triangulation)
Run the code above in your browser using DataLab