pub fn create_dendrogramplot<F: Float + FromPrimitive + PartialOrd + Debug + Display>(
linkage_matrix: ArrayView2<'_, F>,
labels: Option<&[String]>,
config: DendrogramConfig<F>,
) -> Result<DendrogramPlot<F>>Expand description
Create an enhanced dendrogram plot from a linkage matrix
This function takes a linkage matrix (as produced by hierarchical clustering) and creates a comprehensive dendrogram visualization with advanced styling options.
§Arguments
linkage_matrix- The linkage matrix from hierarchical clusteringlabels- Optional labels for the leaf nodesconfig- Configuration options for the dendrogram
§Returns
Result<DendrogramPlot<F>>- The complete dendrogram plot structure
§Example
use scirs2_core::ndarray::Array2;
use scirs2_cluster::hierarchy::visualization::{create_dendrogramplot, DendrogramConfig};
let linkage = Array2::from_shape_vec((3, 4), vec![
0.0, 1.0, 0.1, 2.0,
2.0, 3.0, 0.2, 2.0,
4.0, 5.0, 0.3, 4.0,
]).unwrap();
let labels = Some(vec!["A".to_string(), "B".to_string(), "C".to_string(), "D".to_string()]);
let config = DendrogramConfig::default();
let plot = create_dendrogramplot(linkage.view(), labels.as_deref(), config).unwrap();