Description Usage Arguments Examples
View source: R/plot_skeleton.R
Plots the 0-, 1- and 2-simplices of a simplicial complex and colors the vertices according to the value of one or more functions with support on the underlying set of points. The complex is visualized using a force-directed graph layout acting on the 1-skeleton. Node sizes are proportional to the number of points in the corresponding open set.
1 2 3 4 5 6 7 8 9 10 11 | plot_skeleton(
g2,
k,
r,
g,
b,
pushforward = mean,
seed = 10,
iterations = 1500,
file = ""
)
|
g2 |
an object of the class |
k |
a numeric vector or matrix specifying one or more functions with
support on the set of points that will be mapped to the rainbow palette. Each column
corresponds to a point and each row specifies a different function. If more than one
function is specified, the average of all rows is considered. Incompatible with
the parameters |
r |
similar to |
g |
similar to |
b |
similar to |
pushforward |
pushforward function that maps |
seed |
integer specifying the seed used to initialize the force-directed layout. By default is set to 10. |
iterations |
number of iterations used in the Force Atlas 2 layout. By default is set to 1500. A larger value may be required for optimal visualization of large graphs. |
file |
if specified, exports the 1-skeleton to graphviz DOT |
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 | # Example 1
library(RayleighSelection)
gy <- nerve_complex(list(c(1,4,6,10), c(1,2,7), c(2,3,8), c(3,4,9,10), c(4,5)))
plot_skeleton(gy,k=c(0,1,1,0,0,0,0,0,0,1))
# Example 2: MNIST dataset
data("mnist")
# Compute reduced representation using Laplacian eigenmap of pixels with high variance
library(dimRed)
leim <- LaplacianEigenmaps()
mnist_top <- mnist[apply(mnist, 1, var) > 10000,]
emb <- leim@fun(as(t(mnist_top), "dimRedData"), leim@stdpars)
# Compute Mapper representation using the Laplacian eigenmap as an auxiliary function and correlation
# distance as metric
library(TDAmapper)
mnist_distances <- (1.0 - cor(mnist_top))
m2 <- mapper2D(distance_matrix = mnist_distances,
filter_values = list(emb@data@data[,1], emb@data@data[,2]),
num_intervals = c(30,30),
percent_overlap = 35,
num_bins_when_clustering = 10);
# Compute the nerve complex
gg <- nerve_complex(m2$points_in_vertex)
# Plots simplicial complex colored by the value of the 301th pixel
plot_skeleton(gg, k=mnist[301,])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.