Expand description
Enhanced visualization utilities for dendrograms
This module provides comprehensive tools for visualizing hierarchical clustering results, organized into focused submodules for better maintainability and clarity.
§Modules
types- Core data structures and configuration typesplotting- Dendrogram creation and positioning logiccolors- Color palette generation and managementexport- Export functionality for various formats (SVG, HTML, JSON)
§Quick Start
use scirs2_cluster::hierarchy::visualization::{
create_dendrogramplot, DendrogramConfig, ColorScheme
};
use scirs2_core::ndarray::Array2;
// Create a linkage matrix (from hierarchical clustering)
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();
// Configure the visualization
let mut config = DendrogramConfig::default();
config.color_scheme = ColorScheme::Viridis;
config.show_labels = true;
// Create the plot
let plot = create_dendrogramplot(
linkage.view(),
Some(&["A".to_string(), "B".to_string(), "C".to_string(), "D".to_string()]),
config
).unwrap();
// Export to various formats
let svg = plot.to_svg().unwrap();
let html = plot.to_html().unwrap();
let json = plot.to_json().unwrap();Re-exports§
pub use colors::get_color_palette;pub use colors::interpolate_colors;pub use colors::rgb_to_hex;pub use export::ExportConfig;pub use export::ExportFormat;pub use plotting::create_dendrogramplot;pub use types::BranchStyle;pub use types::ColorScheme;pub use types::ColorThreshold;pub use types::DendrogramConfig;pub use types::DendrogramOrientation;pub use types::DendrogramPlot;pub use types::DendrogramStyling;pub use types::FontWeight;pub use types::MarkerShape;pub use types::TruncateMode;pub use types::*;