Description Usage Arguments Value Examples
Plot a trajectory in a (given) dimensionality reduction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | plot_dimred(
trajectory,
color_cells = c("auto", "none", "grouping", "feature", "milestone", "pseudotime"),
dimred = ifelse(dynwrap::is_wrapper_with_dimred(trajectory), NA,
dyndimred::dimred_landmark_mds),
plot_trajectory = dynwrap::is_wrapper_with_trajectory(trajectory) &&
!plot_milestone_network,
plot_milestone_network = FALSE,
label_milestones = dynwrap::is_wrapper_with_milestone_labelling(trajectory),
alpha_cells = 1,
size_cells = 2.5,
border_radius_percentage = 0.1,
size_milestones = 6,
size_transitions = 2,
hex_cells = ifelse(length(trajectory$cell_ids) > 10000, 100, FALSE),
grouping = NULL,
groups = NULL,
feature_oi = NULL,
color_milestones = c("auto", "given", "cubeHelix", "Set3", "rainbow"),
milestones = NULL,
milestone_percentages = NULL,
pseudotime = NULL,
expression_source = "expression",
arrow = grid::arrow(type = "closed", length = unit(0.1, "inches")),
color_density = c("none", "grouping", "feature"),
padding = 0.1,
nbins = 1000,
bw = 0.2,
density_cutoff = 0.3,
density_cutoff_label = density_cutoff/10,
waypoints = dynwrap::select_waypoints(trajectory),
trajectory_projection_sd = sum(trajectory$milestone_network$length) * 0.05,
color_trajectory = "none"
)
|
trajectory |
A dynwrap trajectory. |
color_cells |
How to color the cells.
|
dimred |
Can be
|
plot_trajectory |
Whether to plot the projected trajectory on the dimensionality reduction |
plot_milestone_network |
Whether to plot the projected milestone network on the dimensionality reduction |
label_milestones |
How to label the milestones. Can be TRUE (in which case the labels within the trajectory will be used), "all" (in which case both given labels and milestone_ids will be used), a named character vector, or FALSE |
alpha_cells |
The alpha of the cells |
size_cells |
The size of the cells |
border_radius_percentage |
The fraction of the radius that is used for the border |
size_milestones |
The size of the milestones |
size_transitions |
The size of the trajectory segments |
hex_cells |
The number of hexes to use, to avoid overplotting points. Default is FALSE if number of cells <= 10000. |
grouping |
A grouping of the cells (e.g. clustering) as a named character vector. |
groups |
A tibble containing character columns |
feature_oi |
The name of a feature to use for colouring the cells. |
color_milestones |
Which palette to use for colouring the milestones
|
milestones |
Tibble containing the column |
milestone_percentages |
The milestone percentages. |
pseudotime |
The pseudotime from the root of the trajectory to the cells as a named numeric vector. |
expression_source |
Source of the expression |
arrow |
The type and size of arrow in case of directed trajectories. Set to NULL to remove arrow altogether. |
color_density |
How to color density, can be "none", "grouping", or "feature". |
padding |
The padding in the edges to the plot, relative to the size of the plot. |
nbins |
Number of bins for calculating the density. |
bw |
Bandwidth, relative to the size of the plot. |
density_cutoff |
Cutoff for density, the lower the larger the areas. |
density_cutoff_label |
Cutoff for density for labeling, the lower the further way from cells. |
waypoints |
The waypoints to use for projecting. Can by generated using |
trajectory_projection_sd |
The standard deviation of the Gaussian kernel to be used for projecting the trajectory. This is in the order of magnitude as the lengths of the milestone_network. The lower, the more closely the trajectory will follow the cells. |
color_trajectory |
How to color the trajectory, can be "nearest" for coloring to nearest cell, or "none". |
A dimensionality reduction ggplot of the data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | data(example_bifurcating)
plot_dimred(example_bifurcating)
# plotting with umap
if (requireNamespace("uwot", quietly = TRUE)) {
plot_dimred(example_bifurcating, dimred = dyndimred::dimred_umap)
}
# using a custom dimred
dimred <- dyndimred::dimred_mds(example_bifurcating$expression)
plot_dimred(example_bifurcating, dimred = dimred)
# coloring cells by pseudotime
plot_dimred(example_bifurcating, color_cells = "pseudotime")
# coloring cells by cluster
plot_dimred(
example_bifurcating,
color_density = "grouping",
grouping = dynwrap::group_onto_nearest_milestones(example_bifurcating)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.