help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back

Hierarchical Tree Map Visualization - Complete Documentation | Plotly | D3.js | Sunburst Charts | Icicle Charts | Tree Maps | Hierarchical Data | Interactive Visualization

Complete Documentation & Project Details for Hierarchical Tree Map Visualization with Plotly and D3.js - Interactive Tree Maps, Sunburst Charts, Icicle Charts, Interactive Drill-Down Capabilities, Custom Color Schemes (Category 20, Category 10, Viridis, Plasma, Rainbow), Data Export (JSON, CSV), Data Import, Search Functionality, Statistics Panel, Interactive Legend, Advanced Filtering, Comparison Mode, and Responsive Design. Perfect for Visualizing Organizational Charts, File Systems, Hierarchical Data Structures, and Hierarchical Data Analysis. Features 1 Comprehensive Jupyter Notebook and 4 Python Modules for Hierarchical Visualization.

Hierarchical Tree Map Visualization - Project Description | Plotly | D3.js | Sunburst Charts | Icicle Charts

This project creates comprehensive Hierarchical Tree Map Visualization using Plotly and D3.js for hierarchical data visualization and tree map analysis. The project includes interactive tree maps with zoom, pan, hover, and click functionality, sunburst charts for circular hierarchical visualization with interactive drill-down, icicle charts for horizontal hierarchical flow charts, interactive drill-down capabilities to explore deeper levels in the hierarchy, custom color schemes (Category 20, Category 10, Viridis, Plasma, Rainbow) with real-time color updates, data export (JSON, CSV formats) for sharing and analysis, data import from JSON and CSV files with auto-format conversion, search functionality with real-time highlighting of search results, statistics panel with real-time metrics (total value, node count, mean, min, max), interactive legend with color-coded items that update automatically, advanced filtering by value ranges and hierarchical levels, comparison mode for comparing multiple datasets side-by-side, and responsive design for all screen sizes. Perfect for visualizing organizational charts, file systems, hierarchical data structures, and hierarchical data analysis.

The Hierarchical Tree Map Visualization project features 1 comprehensive Jupyter notebook (tree_map_visualization.ipynb) covering basic tree maps, sunburst charts, icicle charts, data manipulation, and advanced features. The project includes 4 Python modules (tree_map_plotly.py for tree map visualization, sunburst_plotly.py for sunburst charts, advanced_visualizations.py for advanced features, and data_utils.py for data utility functions). Built with Python 3.8+, Plotly 5.17.0+, D3.js (for web interface), Pandas 2.0.0+, NumPy 1.24.0+, and Jupyter 1.0.0+. The project supports hierarchical data loading from JSON and CSV files, with data conversion utilities for format transformation.

Tree Map Visualization Screenshots | Plotly Tree Maps | D3.js Sunburst Charts | Interactive Hierarchical Visualization Examples

1 / 4
Hierarchical Tree Map Visualization with Plotly and D3.js - Interactive Tree Maps - Sunburst Charts - Icicle Charts - Hierarchical Data Visualization - RSK World

Tree Map Visualization Core Features | Plotly Tree Map Features | Interactive Hierarchical Features

Interactive Tree Maps

  • Interactive tree map visualizations
  • Zoom, pan, hover, and click
  • Customizable colors and sizes
  • Hierarchical drill-down
  • Value-based sizing

Sunburst Charts

  • Circular hierarchical visualization
  • Interactive drill-down
  • Color-coded levels
  • Smooth animations
  • Radial layout

Icicle Charts

  • Horizontal hierarchical layout
  • Interactive exploration
  • Flow chart visualization
  • Level-by-level navigation
  • Rectangular partitions

Custom Color Schemes

  • Category 20, Category 10
  • Viridis, Plasma, Rainbow
  • Real-time color updates
  • Dynamic legend generation
  • 5 color scheme options

Search Functionality

  • Node name search
  • Real-time highlighting
  • Case-insensitive search
  • Visual search results
  • Instant feedback

Jupyter Notebook

  • tree_map_visualization.ipynb
  • Interactive exploration
  • Step-by-step examples
  • All features demonstrated
  • Comprehensive tutorial

Advanced Tree Map Features | Data Export | Search Functionality | Statistics Panel | Comparison Mode

Data Export

  • JSON data export
  • CSV data export
  • Data download
  • Format conversion

Data Import

  • JSON file upload
  • CSV file upload
  • Auto-format conversion
  • File validation

Statistics Panel

  • Total value calculation
  • Node count statistics
  • Mean, min, max values
  • Auto-updating statistics

Comparison Mode

  • Side-by-side comparison
  • Multiple dataset analysis
  • Difference visualization
  • Statistical comparison

Visualization Types | Tree Map Types | Hierarchical Visualization Features

Visualization Type Description Use Case
Interactive Tree Maps Rectangular hierarchical visualization with interactive zoom, pan, hover, and click Visualize hierarchical data structures, organizational charts, file systems
Sunburst Charts Circular hierarchical visualization with radial layout and interactive drill-down Display hierarchical data in circular format, explore nested structures
Icicle Charts Horizontal hierarchical flow charts with rectangular partitions Show hierarchical flow in horizontal layout, level-by-level navigation
Interactive Drill-Down Click to explore deeper levels in the hierarchy with smooth transitions Navigate through hierarchical levels, explore nested data structures
Custom Color Schemes Multiple color palettes (Category 20, Category 10, Viridis, Plasma, Rainbow) Customize visualization appearance, improve data distinction
Search Functionality Search nodes by name with real-time highlighting and visual feedback Find specific nodes quickly, highlight search results
Statistics Panel Real-time statistics display (total value, node count, mean, min, max) Understand data distribution, track key metrics
Data Export/Import Export to JSON/CSV, import from JSON/CSV with format conversion Share data, integrate with other tools, data persistence
Advanced Filtering Filter data by value ranges and hierarchical levels Focus on specific data subsets, customize visualization
Comparison Mode Compare multiple datasets side-by-side with statistical analysis Analyze differences between datasets, compare hierarchical structures
Interactive Legend Dynamic legend generation with color-coded items Understand color mapping, visual reference guide

Technologies Used | Python Technologies | Tree Map Visualization Stack | Hierarchical Visualization Tools

This Hierarchical Tree Map Visualization project is built using modern Python visualization and hierarchical data visualization technologies. The core implementation uses Python 3.8+ as the primary programming language, Plotly 5.17.0+ for creating interactive tree maps, sunburst charts, and icicle charts, and D3.js for web-based hierarchical visualizations. The project includes Pandas 2.0.0+ for data manipulation, NumPy 1.24.0+ for numerical computing, and Jupyter 1.0.0+ for interactive development. The visualization library features interactive tree maps with zoom, pan, hover, and click, sunburst charts for circular hierarchical visualization, icicle charts for horizontal hierarchical flow, interactive drill-down capabilities, custom color schemes (Category 20, Category 10, Viridis, Plasma, Rainbow), data export (JSON, CSV), data import from JSON and CSV files, search functionality with real-time highlighting, statistics panel with real-time metrics, interactive legend, advanced filtering, comparison mode, and responsive design for hierarchical data visualization, organizational chart visualization, and file system visualization.

The project uses Plotly as the core visualization library and D3.js for web-based interactive visualizations with Python. It supports hierarchical visualization through interactive tree maps with customizable colors and sizes, sunburst charts with radial layout and interactive drill-down, icicle charts with horizontal flow and level-by-level navigation, interactive drill-down to explore deeper levels, custom color schemes with real-time updates, data export/import (JSON, CSV formats), search functionality with real-time highlighting, statistics panel with total value, node count, mean, min, max, interactive legend with color-coded items, advanced filtering by value ranges, comparison mode for multiple datasets, and responsive design for all screen sizes. The project includes hierarchical data loading from JSON and CSV files with data conversion utilities. The system includes interactive features such as zoom and pan, hover tooltips with node data, click handlers for drill-down, customizable color schemes, and HTML export capabilities for hierarchical data visualization, organizational charts, file system visualization, and hierarchical data analysis applications.

Python 3.8+ Plotly 5.17.0+ D3.js Pandas 2.0.0+ NumPy 1.24.0+ Jupyter 1.0.0+ Tree Maps Sunburst Charts Icicle Charts Hierarchical Data

Installation & Usage Guide | How to Install Tree Map Visualization | Setup Tutorial

Installation

Version: v1.0.0 (December 2024)

Install all required dependencies for the Hierarchical Tree Map Visualization project:

# Install all requirements pip install -r requirements.txt # Required packages: # - plotly>=5.17.0 # - pandas>=2.0.0 # - numpy>=1.24.0 # - jupyter>=1.0.0 # Verify installation python test_project.py

Running Jupyter Notebooks

Start Jupyter Notebook to explore the tree map visualization examples:

# Start Jupyter Notebook jupyter notebook # Or use JupyterLab jupyter lab # Open the notebook: # - tree_map_visualization.ipynb - Main visualization notebook with all features # * Interactive tree maps # * Sunburst charts # * Icicle charts # * Interactive drill-down # * Custom color schemes # * Data export/import # * Search functionality # * Statistics panel # * Advanced filtering # * Comparison mode

Running Example Scripts

Run Python scripts to generate tree map visualizations:

# Run main tree map script: python tree_map_plotly.py # This will: # - Load hierarchical data # - Create interactive tree map # - Generate interactive HTML visualization # - Display in browser # Run sunburst chart script: python sunburst_plotly.py # Run advanced visualizations: python advanced_visualizations.py # Example usage in Python: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly from sunburst_plotly import create_sunburst_from_csv # Load and create tree map data = load_hierarchical_data() fig = create_treemap_plotly(data, title="My Tree Map") fig.show()

Project Features

Explore the comprehensive tree map visualization features:

# Project Features (v1.0.0 - December 2024): # 1. Interactive Tree Maps - Rectangular hierarchical visualization with Plotly # 2. Sunburst Charts - Circular hierarchical visualization with radial layout # 3. Icicle Charts - Horizontal hierarchical flow charts # 4. Interactive Drill-Down - Click to explore deeper levels in hierarchy # 5. Custom Color Schemes (5 Types) - Category 20, Category 10, Viridis, Plasma, Rainbow # 6. Data Export - JSON and CSV export formats # 7. Data Import - Upload JSON and CSV files with auto-format conversion # 8. Search Functionality - Search nodes by name with real-time highlighting # 9. Statistics Panel - Real-time metrics (total value, node count, mean, min, max) # 10. Interactive Legend - Dynamic legend with color-coded items # 11. Advanced Filtering - Filter data by value ranges and hierarchical levels # 12. Comparison Mode - Compare multiple datasets side-by-side # 13. Responsive Design - Works on all screen sizes # 14. Data Loading - Load hierarchical data from JSON and CSV files # 15. 1 Jupyter Notebook - tree_map_visualization.ipynb with all features # 16. 4 Python Modules - tree_map_plotly, sunburst_plotly, advanced_visualizations, data_utils # All features are demonstrated in the Jupyter notebook

Basic Usage Example

Create tree map visualizations with Python:

# Basic Usage Example: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly from sunburst_plotly import create_sunburst_chart from advanced_visualizations import create_interactive_treemap from data_utils import load_json_data, get_node_statistics # Load hierarchical data data = load_hierarchical_data() # Create tree map fig1 = create_treemap_plotly(data, title="My Tree Map") fig1.show() # Create sunburst chart fig2 = create_sunburst_chart(data, title="My Sunburst Chart") fig2.show() # Create interactive tree map with custom colors fig3 = create_interactive_treemap(data, title="Interactive Tree Map", colorscale='Viridis') fig3.show() # Get statistics stats = get_node_statistics(data) print(f"Total Value: {stats['total_value']}") print(f"Node Count: {stats['node_count']}")

Project Structure | Tree Map Visualization File Structure | Source Code Organization

tree-map-viz/
├── README.md # Main documentation
├── FEATURES.md # Complete features list
├── CHANGELOG.md # Version history
├── PROJECT_FILES_SUMMARY.md # Project summary
├── CONTRIBUTING.md # Contribution guidelines
├── AUTHORS.md # Contributors
├── ERRORS_FIXED.md # Error fixes
├── requirements.txt # Python dependencies
├── setup.py # Package setup script
├── MANIFEST.in # Package manifest
├── .gitignore # Git ignore file
├── LICENSE # MIT License
│
├── tree_map_visualization.ipynb # Main visualization notebook
│ # Interactive tree maps
│ # Sunburst charts, icicle charts
│ # Data manipulation, advanced features
│
├── tree_map_plotly.py # Tree map visualization script
├── sunburst_plotly.py # Sunburst chart script
├── advanced_visualizations.py # Advanced visualization features
├── data_utils.py # Data utility functions
├── index.html # Web interface (D3.js)
│
├── data/ # Data directory
│ ├── sample_hierarchical_data.json # Sample hierarchical data
│ ├── organizational_data.csv # Organizational data
│ ├── file_system_data.json # File system data
│ └── sales_data.json # Sales data
│
└── assets/ # Web assets ├── styles.css # CSS styles └── visualizations.js # D3.js visualization code

Configuration Options | Plotly Configuration | Tree Map Visualization Customization Guide

Plotly Configuration

Version: v1.0.0 (December 2024)

Customize tree map visualization settings in Python code:

# Plotly Configuration for Tree Map Visualization import plotly.graph_objects as go from tree_map_plotly import load_hierarchical_data, create_treemap_plotly from advanced_visualizations import create_interactive_treemap # Default configuration in tree_map_plotly.py: # - colorscale: 'Viridis' (can be 'Category20', 'Category10', 'Viridis', 'Plasma', 'Rainbow') # - branchvalues: 'total' (sum of children values) # - textinfo: 'label+value+percent parent' # - height: 800 (figure height in pixels) # - width: 1200 (figure width in pixels) # Customize in function calls: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly data = load_hierarchical_data() fig = create_treemap_plotly( data, title="Custom Tree Map", colorscale='Viridis', # Change color scheme height=1000, # Adjust height width=1400 # Adjust width ) # Available color schemes: # - 'Category20' (default): 20 distinct colors # - 'Category10': 10 distinct colors # - 'Viridis': Perceptually uniform colormap # - 'Plasma': Perceptually uniform colormap # - 'Rainbow': Rainbow color scale

Configuration Tips:

  • COLORSCALE: Choose from 'Category20', 'Category10', 'Viridis', 'Plasma', 'Rainbow'. Default: 'Category20'
  • BRANCHVALUES: 'total' (sum of children) or 'remainder' (parent minus children). Default: 'total'
  • TEXTINFO: Control displayed text: 'label', 'value', 'percent parent', 'percent root'. Default: 'label+value+percent parent'
  • HOOVERTEMPLATE: Customize hover tooltip information and format
  • DIMENSIONS: Set figure height and width in pixels. Default: 800x1200
  • EXPORT_FORMAT: HTML (interactive), JSON (data export), CSV (data export)

Hierarchical Data Format Requirements

Works with hierarchical data from JSON files or CSV files. Required structure:

# Supported data formats: # - JSON files with hierarchical structure (nested objects with name, value, children) # - CSV files with hierarchical columns (Department, SubDepartment, Value) # Required JSON structure: from data_utils import load_json_data # Load hierarchical data from JSON: data = load_json_data('data/sample_hierarchical_data.json') # Required JSON structure: # { # "name": "Root", # "value": 100, # "children": [ # {"name": "Child1", "value": 50, "children": [...]}, # {"name": "Child2", "value": 50} # ] # } # Required CSV structure (for organizational data): # Department,SubDepartment,Value # Sales,North,100 # Sales,South,150 # Marketing,Digital,200 # Works with: # - Any hierarchical data in JSON format # - CSV files with hierarchical columns # - Nested data structures # - Data created programmatically

Customizing Tree Map Appearance

Modify tree map visualization configurations in tree_map_plotly.py:

# Tree map customization in Python: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly import plotly.graph_objects as go # Load hierarchical data data = load_hierarchical_data() # Create tree map fig = create_treemap_plotly(data, title="My Tree Map") # Customize layout: fig.update_layout( title={ 'text': 'Custom Tree Map', 'x': 0.5, 'font': {'size': 24, 'color': '#1e293b'} }, height=1000, # Adjust height width=1400, # Adjust width margin=dict(l=50, r=50, t=80, b=50), showlegend=True ) # Customize appearance: # Colors based on color scheme (Category20, Viridis, etc.) # Sizes based on value # Text info based on textinfo parameter # Save customized tree map fig.write_html('custom_treemap.html')

Adding Custom Tree Map Visualizations

Add new tree map visualizations using Plotly:

# Add new visualization function to tree_map_plotly.py: import plotly.graph_objects as go from data_utils import load_json_data def create_custom_treemap(data, title='Custom Tree Map', **kwargs): """Create a custom tree map visualization.""" def flatten_data(node, parent_path="", result=None): if result is None: result = [] current_path = f"{parent_path}/{node['name']}" if parent_path else node['name'] result.append({ 'path': current_path, 'value': node['value'], 'name': node['name'], 'parent': parent_path }) if 'children' in node: for child in node['children']: flatten_data(child, current_path, result) return result flattened = flatten_data(data) # Create tree map fig = go.Figure(go.Treemap( labels=[item['name'] for item in flattened], parents=[item['parent'] for item in flattened], values=[item['value'] for item in flattened], textinfo="label+value+percent parent", hovertemplate='%{label}
Value: %{value}', marker=dict(colorscale=kwargs.get('colorscale', 'Viridis')) )) fig.update_layout( title=title, height=kwargs.get('height', 800), width=kwargs.get('width', 1200) ) # Save if output file provided if kwargs.get('output_file'): fig.write_html(kwargs['output_file']) print(f"Tree map saved as '{kwargs['output_file']}'") return fig # Use in your code: from data_utils import load_json_data from tree_map_plotly import create_custom_treemap data = load_json_data('data/sample_hierarchical_data.json') fig = create_custom_treemap(data, title='My Custom Tree Map', colorscale='Plasma', output_file='custom_treemap.html')

Project Architecture | Tree Map Visualization Architecture | System Architecture | Technical Architecture

Tree Map Visualization Architecture

1. Plotly and D3.js Visualization Framework:

  • Built on Plotly for interactive tree map, sunburst, and icicle visualizations
  • Uses D3.js for web-based interactive hierarchical visualizations
  • Tree maps with rectangular hierarchical partitions
  • Sunburst charts with circular radial layout
  • Icicle charts with horizontal flow visualization
  • Interactive HTML output with zoom, pan, hover, and click

2. Data Processing Pipeline:

  • JSON file loading for hierarchical data (nested structures)
  • CSV file loading with hierarchical columns (Department, SubDepartment, Value)
  • Data conversion utilities (CSV to hierarchical, hierarchical to CSV)
  • Data validation and hierarchical structure validation
  • Statistics calculation (total value, node count, mean, min, max)

3. Visualization Components:

  • Tree maps for rectangular hierarchical visualization
  • Sunburst charts for circular hierarchical visualization
  • Icicle charts for horizontal hierarchical flow
  • Interactive drill-down for exploring deeper levels
  • Custom color schemes with real-time updates
  • Search functionality with real-time highlighting
  • Statistics panel with comprehensive metrics

Module Structure

The project is organized into focused modules:

# Module Structure: # tree_map_plotly.py - Tree map visualization functions from tree_map_plotly import ( load_hierarchical_data, # Load hierarchical data from JSON create_treemap_plotly # Create tree map visualization ) # sunburst_plotly.py - Sunburst chart visualization functions from sunburst_plotly import ( load_hierarchical_data, # Load hierarchical data create_sunburst_chart, # Create sunburst chart create_sunburst_from_csv # Create sunburst from CSV ) # advanced_visualizations.py - Advanced visualization features from advanced_visualizations import ( create_interactive_treemap, # Create interactive tree map create_animated_sunburst, # Create animated sunburst create_comparison_visualization # Compare multiple datasets ) # data_utils.py - Data utility functions from data_utils import ( load_json_data, # Load data from JSON save_json_data, # Save data to JSON csv_to_hierarchical, # Convert CSV to hierarchical hierarchical_to_csv, # Convert hierarchical to CSV filter_data_by_value, # Filter data by value range search_in_data, # Search nodes in data get_node_statistics # Get statistics (total, count, mean, etc.) )

Data Format and Processing

How hierarchical data is processed for visualization:

# Data Format Requirements: # Hierarchical JSON format (nested objects with name, value, children) # Example JSON structure: # { # "name": "Root", # "value": 100, # "children": [ # {"name": "Child1", "value": 50, "children": [...]}, # {"name": "Child2", "value": 50} # ] # } # Or CSV format (Department, SubDepartment, Value): # Department,SubDepartment,Value # Sales,North,100 # Sales,South,150 # Data Processing Flow: from data_utils import load_json_data, csv_to_hierarchical from tree_map_plotly import create_treemap_plotly # Load hierarchical data from JSON data = load_json_data('data/sample_hierarchical_data.json') # Or convert CSV to hierarchical data = csv_to_hierarchical('data/organizational_data.csv') # Create visualization fig = create_treemap_plotly(data, title="My Tree Map") fig.write_html('tree_map.html')

Visualization Types and Usage

Different tree map visualization types and their use cases:

  • Tree Maps: Rectangular hierarchical visualization using go.Treemap() with Plotly
  • Sunburst Charts: Circular hierarchical visualization using go.Sunburst() with radial layout
  • Icicle Charts: Horizontal hierarchical flow using go.Icicle() with rectangular partitions
  • Interactive Drill-Down: Click handlers using Plotly's click events to explore deeper levels
  • Custom Color Schemes: Color scales using Plotly color scales (Category20, Viridis, Plasma, Rainbow)
  • Data Export/Import: JSON/CSV conversion using data_utils functions
  • Search Functionality: Node search using string matching and highlighting
  • Statistics Panel: Real-time metrics using get_node_statistics() function
  • Advanced Filtering: Value range filtering using filter_data_by_value() function
  • Comparison Mode: Side-by-side comparison using multiple figure subplots

Advanced Features Usage | Tree Map Visualization Usage Guide | How to Use Tree Map Visualization

Using Basic Network Functions

How to create different types of network visualizations:

# Basic Tree Map Usage Examples: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly from sunburst_plotly import create_sunburst_chart from data_utils import load_json_data, csv_to_hierarchical # Load hierarchical data data = load_hierarchical_data() # Or load from JSON: data = load_json_data('data/sample_hierarchical_data.json') # Or convert CSV: data = csv_to_hierarchical('data/organizational_data.csv') # 1. Create Basic Tree Map: fig1 = create_treemap_plotly(data, title='Tree Map') fig1.show() # 2. Create Sunburst Chart: fig2 = create_sunburst_chart(data, title='Sunburst Chart') fig2.show() # 3. Create Interactive Tree Map with Custom Colors: from advanced_visualizations import create_interactive_treemap fig3 = create_interactive_treemap(data, title='Interactive Tree Map', colorscale='Viridis') fig3.show() # 4. Create Tree Map with Statistics: from data_utils import get_node_statistics stats = get_node_statistics(data) print(f"Total Value: {stats['total_value']}, Node Count: {stats['node_count']}") # 5. Create Comparison Visualization: from advanced_visualizations import create_comparison_visualization fig5 = create_comparison_visualization([data, data2], titles=['Dataset 1', 'Dataset 2']) fig5.show()

Using Advanced Features

Create advanced tree map visualizations:

# Advanced Features Usage: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly from advanced_visualizations import create_interactive_treemap, create_comparison_visualization from data_utils import load_json_data, get_node_statistics, filter_data_by_value, search_in_data # Load hierarchical data data = load_hierarchical_data() # 1. Statistics Analysis: stats = get_node_statistics(data) print(f"Total Value: {stats['total_value']}") print(f"Node Count: {stats['node_count']}") print(f"Mean Value: {stats['mean_value']}") # 2. Search Functionality: search_results = search_in_data(data, 'Sales') print(f"Found nodes: {search_results}") # 3. Advanced Filtering: filtered_data = filter_data_by_value(data, min_value=50, max_value=200) fig = create_treemap_plotly(filtered_data, title='Filtered Tree Map') fig.show() # 4. Interactive Tree Map with Custom Colors: fig = create_interactive_treemap(data, title='Interactive Tree Map', colorscale='Plasma') fig.show() # 5. Comparison Visualization: data2 = load_json_data('data/sales_data.json') fig = create_comparison_visualization([data, data2], titles=['Organizational', 'Sales']) fig.show() # 6. Data Export: from data_utils import save_json_data, hierarchical_to_csv save_json_data(data, 'exported_data.json') hierarchical_to_csv(data, 'exported_data.csv')

Understanding Visualization Types

When to use different visualization types for hierarchical data:

# Visualization Type Usage Guide: # 1. Tree Maps # - Use: Visualize hierarchical data in rectangular partitions # - Shows: Nested rectangles sized by value, color-coded by level # - Best for: Understanding value distribution, comparing sizes # - Example: Organizational charts, file systems, sales data # 2. Sunburst Charts # - Use: Display hierarchical data in circular radial format # - Shows: Concentric rings representing hierarchy levels # - Best for: Circular hierarchical exploration, radial navigation # - Example: Organizational structures, category breakdowns, nested data # 3. Icicle Charts # - Use: Show hierarchical flow in horizontal layout # - Shows: Horizontal rectangular partitions flowing left to right # - Best for: Horizontal hierarchy exploration, flow visualization # - Example: Process flows, organizational hierarchies, sequential data # 4. Interactive Drill-Down # - Use: Explore deeper levels in the hierarchy # - Shows: Click to navigate to child nodes, smooth transitions # - Best for: Exploring nested structures, detailed investigation # - Example: File system navigation, organizational exploration # 5. Custom Color Schemes # - Use: Customize visualization appearance # - Shows: Different color palettes (Category20, Viridis, Plasma, Rainbow) # - Best for: Improving distinction, matching brand colors # - Example: Brand-aligned visualizations, improved readability # 6. Search Functionality # - Use: Find specific nodes quickly # - Shows: Real-time highlighting of search results # - Best for: Large hierarchies, finding specific items # - Example: Finding departments, locating files, searching data # 7. Statistics Panel # - Use: Understand data distribution and metrics # - Shows: Total value, node count, mean, min, max values # - Best for: Data analysis, understanding distribution # - Example: Sales analysis, budget analysis, data overview # 8. Advanced Filtering # - Use: Focus on specific data subsets # - Shows: Filtered visualization based on value ranges # - Best for: Analyzing subsets, focusing on ranges # - Example: High-value items, low-value analysis, range filtering # 9. Comparison Mode # - Use: Compare multiple datasets side-by-side # - Shows: Multiple visualizations with statistical comparison # - Best for: Dataset comparison, before/after analysis # - Example: Year-over-year comparison, department comparison # 10. Data Export/Import # - Use: Share data and integrate with other tools # - Shows: JSON/CSV export and import with format conversion # - Best for: Data sharing, tool integration, data persistence # - Example: Exporting results, importing external data

Data Preparation and Customization

Prepare and customize your network data for analysis:

# Data Preparation Examples: from data_utils import load_json_data, csv_to_hierarchical, save_json_data, hierarchical_to_csv from tree_map_plotly import load_hierarchical_data # 1. Load Hierarchical Data from JSON: data = load_json_data('data/sample_hierarchical_data.json') # Returns hierarchical dictionary structure # 2. Load from CSV and Convert to Hierarchical: data = csv_to_hierarchical('data/organizational_data.csv') # Converts CSV to hierarchical format # 3. Create Hierarchical Data Programmatically: data = { "name": "Root", "value": 100, "children": [ {"name": "Child1", "value": 50, "children": []}, {"name": "Child2", "value": 50} ] } # 4. Add Node Attributes: def add_attributes(node): node['label'] = node.get('name', 'Unknown') node['category'] = node.get('category', 'default') if 'children' in node: for child in node['children']: add_attributes(child) add_attributes(data) # 5. Filter Data by Value: from data_utils import filter_data_by_value filtered_data = filter_data_by_value(data, min_value=50, max_value=200) # 6. Search in Data: from data_utils import search_in_data search_results = search_in_data(data, 'Sales') # 7. Get Statistics: from data_utils import get_node_statistics stats = get_node_statistics(data) # Returns dictionary with total_value, node_count, mean_value, etc.

Exporting Tree Maps

Export tree maps and data to different formats:

# Export Tree Map Examples: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly from data_utils import save_json_data, hierarchical_to_csv, get_node_statistics # Load hierarchical data data = load_hierarchical_data() # Create visualization fig = create_treemap_plotly(data, title="My Tree Map") # 1. Export as HTML (interactive, default): fig.write_html('tree_map.html') # Opens in browser with full interactivity # 2. Export Data as JSON: save_json_data(data, filename='tree_map_data.json') # 3. Export Data as CSV: hierarchical_to_csv(data, filename='tree_map_data.csv') # 4. Export Statistics: stats = get_node_statistics(data) import json with open('statistics.json', 'w') as f: json.dump(stats, f, indent=2) # 5. Export Filtered Data: from data_utils import filter_data_by_value filtered = filter_data_by_value(data, min_value=50, max_value=200) save_json_data(filtered, filename='filtered_data.json')

Complete Tree Map Visualization Workflow | Step-by-Step Guide | Tree Map Tutorial

Step-by-Step Tree Map Visualization Setup

Step 1: Install Dependencies

# Install all required packages pip install -r requirements.txt # Required packages: # - plotly>=5.17.0 # - pandas>=2.0.0 # - numpy>=1.24.0 # - jupyter>=1.0.0 # Verify installation python -c "import plotly; import pandas; import numpy; print('Installation successful!')"

Step 2: Prepare Hierarchical Data

# Option 1: Load hierarchical data from JSON file from data_utils import load_json_data # Load hierarchical data (nested structure) data = load_json_data('data/sample_hierarchical_data.json') # Option 2: Load from CSV and convert to hierarchical from data_utils import csv_to_hierarchical data = csv_to_hierarchical('data/organizational_data.csv') # Option 3: Create hierarchical data programmatically data = { "name": "Root", "value": 100, "children": [ {"name": "Child1", "value": 50}, {"name": "Child2", "value": 50} ] } # Data format (JSON): # { # "name": "Root", # "value": 100, # "children": [{"name": "Child1", "value": 50}] # }

Step 3: Create Basic Tree Map Visualizations

# Run main tree map script: python tree_map_plotly.py # This will: # - Load hierarchical data # - Create interactive tree map # - Generate interactive HTML visualization # - Display in browser # Or create visualizations programmatically: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly from sunburst_plotly import create_sunburst_chart data = load_hierarchical_data() fig = create_treemap_plotly(data, title="My Tree Map") fig.show() # Export visualization: fig.write_html('tree_map.html') # Open HTML file in browser to view interactive tree map

Step 4: Explore Jupyter Notebook

  • Open tree_map_visualization.ipynb for comprehensive tutorial
  • Run cells step-by-step to learn each visualization type
  • Explore interactive tree maps, sunburst charts, icicle charts
  • Modify code examples to use different hierarchical data
  • Export visualizations as HTML, JSON, or CSV

Step 5: Customize Tree Map Visualizations

# Customize tree map visualizations in Python code: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly data = load_hierarchical_data() # Change color scheme fig = create_treemap_plotly(data, title="Tree Map", colorscale='Viridis') # Available colorscales: 'Category20', 'Category10', 'Viridis', 'Plasma', 'Rainbow' # Adjust dimensions fig.update_layout(height=1000, width=1400) # Customize text info # Options: 'label', 'value', 'percent parent', 'percent root' # Use advanced features from advanced_visualizations import create_interactive_treemap fig = create_interactive_treemap(data, title="Interactive Tree Map", colorscale='Plasma') # Modify tree_map_plotly.py for advanced configurations

Tree Map Visualization Customization Examples | Customization Guide | Code Examples

Customizing Color Schemes

Change color schemes and styling for tree maps:

# Customize Color Schemes: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly data = load_hierarchical_data() # Available color schemes: # 'Category20' (default), 'Category10', 'Viridis', 'Plasma', 'Rainbow' # Example 1: Use Category20 (default, 20 distinct colors) fig = create_treemap_plotly(data, title="Tree Map", colorscale='Category20') fig.show() # Example 2: Use Viridis (perceptually uniform) fig = create_treemap_plotly(data, title="Tree Map", colorscale='Viridis') fig.show() # Example 3: Use Plasma (perceptually uniform) fig = create_treemap_plotly(data, title="Tree Map", colorscale='Plasma') fig.show() # Example 4: Use Rainbow fig = create_treemap_plotly(data, title="Tree Map", colorscale='Rainbow') fig.show() # Note: Category20 is default for better color distinction

Adjusting Tree Map Appearance

Control text info, hover templates, and visual styling:

# Adjust Tree Map Appearance: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly import plotly.graph_objects as go data = load_hierarchical_data() # Text info options: # - 'label' - Show node names # - 'value' - Show node values # - 'percent parent' - Show percentage of parent # - 'percent root' - Show percentage of root # Example 1: Show label and value fig = go.Figure(go.Treemap( labels=[...], values=[...], textinfo="label+value" )) fig.show() # Example 2: Show label, value, and percent parent fig = go.Figure(go.Treemap( labels=[...], values=[...], textinfo="label+value+percent parent" )) fig.show() # Example 3: Custom hover template fig = go.Figure(go.Treemap( labels=[...], values=[...], hovertemplate='%{label}
Value: %{value}
Percentage: %{percentParent:.2%}' )) fig.show() # Example 4: Adjust dimensions fig = create_treemap_plotly(data, title="Tree Map") fig.update_layout(height=1000, width=1400) fig.show()

Changing Visualization Types

Create different types of hierarchical visualizations:

# Create Different Visualization Types: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly from sunburst_plotly import create_sunburst_chart from advanced_visualizations import create_interactive_treemap data = load_hierarchical_data() # Available visualization types: # 'treemap' - Rectangular hierarchical visualization # 'sunburst' - Circular radial visualization # 'icicle' - Horizontal flow visualization # Example 1: Tree Map fig1 = create_treemap_plotly(data, title="Tree Map") fig1.show() # Example 2: Sunburst Chart fig2 = create_sunburst_chart(data, title="Sunburst Chart") fig2.show() # Example 3: Interactive Tree Map with Custom Colors fig3 = create_interactive_treemap(data, title="Interactive Tree Map", colorscale='Plasma') fig3.show() # Example 4: Tree Map with Different Color Scheme fig4 = create_treemap_plotly(data, title="Tree Map", colorscale='Viridis') fig4.show() # Tip: Tree maps for value comparison, sunburst for circular exploration

Modifying Data Source

Load hierarchical data from different sources:

# Load Hierarchical Data from Different Sources: from data_utils import load_json_data, csv_to_hierarchical from tree_map_plotly import create_treemap_plotly import json # Option 1: Load from JSON file (hierarchical format, recommended) data = load_json_data('data/sample_hierarchical_data.json') # Required structure: {"name": "...", "value": ..., "children": [...]} # Option 2: Load from CSV and convert to hierarchical data = csv_to_hierarchical('data/organizational_data.csv') # Required columns: Department, SubDepartment, Value # Option 3: Create hierarchical data programmatically data = { "name": "Root", "value": 100, "children": [ {"name": "Child1", "value": 50}, {"name": "Child2", "value": 50} ] } # Option 4: Load from JSON file directly with open('data/sample_hierarchical_data.json', 'r') as f: data = json.load(f) # Option 5: Load different sample datasets data1 = load_json_data('data/sample_hierarchical_data.json') # Organizational data2 = load_json_data('data/file_system_data.json') # File system data3 = load_json_data('data/sales_data.json') # Sales data # Then create visualization fig = create_treemap_plotly(data, title="My Tree Map") fig.write_html('tree_map.html')

Customizing Tree Map Layout

Modify tree map appearance and layout settings:

# Customize Tree Map Layout: from tree_map_plotly import load_hierarchical_data, create_treemap_plotly import plotly.graph_objects as go # Load hierarchical data data = load_hierarchical_data() # Create visualization fig = create_treemap_plotly(data, title="My Tree Map") # Customize layout fig.update_layout( title={ 'text': 'Custom Tree Map', 'x': 0.5, 'font': {'size': 24, 'color': '#1e293b'} }, height=1000, # Adjust height (default: 800) width=1400, # Adjust width (default: 1200) margin=dict(l=50, r=50, t=80, b=50), showlegend=True ) # Customize colors fig.update_traces( marker=dict(colorscale='Viridis'), textinfo="label+value+percent parent" ) # Save customized tree map fig.write_html('custom_treemap.html')

Network Data Information | Data Format | Edge List Format | Data Requirements

Data Format Requirements

The project works with edge list format for network data:

  • Required columns: source, target (weight is optional)
  • Node identifiers: Can be strings, integers, or any hashable type
  • Edge weights: Numeric values (optional, defaults to 1.0)
  • Automatic NetworkX Graph object creation
  • Support for directed and undirected networks
  • Automatic network validation and structure checking

Sample Data Format

Your network data CSV file should follow this structure:

# CSV file structure (network_data.csv): source,target,weight A,B,1.0 B,C,2.0 C,D,1.5 A,C,0.8 B,D,1.2 C,E,2.5 # Column descriptions: # - source: Source node identifier (string or integer) # - target: Target node identifier (string or integer) # - weight: Edge weight (numeric, optional, defaults to 1.0) # For unweighted networks, weight column can be omitted: # source,target # A,B # B,C # C,D # For multiple networks, use separate files or create multiple Graph objects

Loading Hierarchical Data

Load hierarchical data from JSON or CSV files:

# Load hierarchical data from JSON or CSV from data_utils import load_json_data, csv_to_hierarchical # Load from JSON (recommended): data = load_json_data('data/sample_hierarchical_data.json') # Load from CSV and convert: data = csv_to_hierarchical('data/organizational_data.csv') # Or create programmatically: data = { "name": "Root", "value": 100, "children": [ {"name": "Child1", "value": 50}, {"name": "Child2", "value": 50} ] } # Sample datasets available: # - sample_hierarchical_data.json (organizational structure) # - organizational_data.csv (department data) # - file_system_data.json (file system hierarchy) # - sales_data.json (sales revenue data) # Save hierarchical data: from data_utils import save_json_data, hierarchical_to_csv save_json_data(data, 'my_data.json') hierarchical_to_csv(data, 'my_data.csv')

Using Your Own Hierarchical Data

Use your own hierarchical data for visualization:

# Steps to use your own hierarchical data: # 1. Prepare your JSON file # - Required: name, value fields (children is optional) # - Name: Node identifier (string) # - Value: Numeric value for sizing # - Children: Array of child nodes (optional, for nested structure) # 2. Load and validate data from data_utils import load_json_data data = load_json_data('your_hierarchical_data.json') # Returns hierarchical dictionary structure # 3. Create visualization from tree_map_plotly import create_treemap_plotly from sunburst_plotly import create_sunburst_chart fig = create_treemap_plotly(data, title="My Tree Map") fig.write_html('tree_map.html') # 4. Verify data format # - Check name and value fields exist # - Ensure values are numeric # - Verify hierarchical structure is valid # - Check for proper nesting (children arrays) # 5. Use with all visualization types # - All visualization types work with your data # - Tree maps work automatically # - Sunburst charts work with any hierarchical data # - Icicle charts work with validated hierarchical structures

Troubleshooting & Best Practices | Common Issues | Performance Optimization | Best Practices

Common Issues

  • Data Not Loading: Ensure JSON file has correct format (name, value, children structure). Check file path is correct
  • Hierarchical Data Not Found: Verify JSON file exists and has proper hierarchical structure. Check required fields (name, value)
  • Import Errors: Verify all dependencies installed: pip install -r requirements.txt. Check Python version (3.8+)
  • Data Format Errors: Ensure name and value fields exist. Verify values are numeric. Check hierarchical structure is valid
  • Visualization Not Rendering: Check browser console for JavaScript errors. Verify Plotly is loaded correctly. Check data size (very large hierarchies may be slow)
  • Slow Performance: Reduce hierarchy depth, filter low-value nodes, or process in smaller subsets for large hierarchies
  • Memory Issues: Reduce number of nodes, use data filtering, or process in smaller hierarchical subsets
  • Color Scheme Not Working: Verify color scheme name is correct ('Category20', 'Viridis', 'Plasma', 'Rainbow')
  • Search Not Working: Check search function is called correctly. Verify data structure supports search
  • Statistics Not Calculating: Ensure data has valid numeric values. Check get_node_statistics function is used correctly
  • Export Not Working: Verify file path is writable. Check JSON/CSV export functions are called correctly
  • HTML Files Not Opening: Open HTML files in modern browser (Chrome, Firefox, Edge). Check file path is correct
  • Drill-Down Not Working: Ensure data has children structure. Check click handlers are properly configured

Performance Optimization Tips

  • Hierarchy Size: Reduce hierarchy depth or filter low-value nodes to improve performance
  • Visualization Type: Use simpler visualizations for large hierarchies (tree maps are faster than sunburst for very large data)
  • Color Scheme: Choose appropriate color scheme based on hierarchy size (Category20 for many nodes, Viridis for continuous data)
  • Caching: Cache data processing results to avoid repeated calculations
  • Data Preprocessing: Pre-process and validate hierarchical data before creating visualizations
  • Data Validation: Validate hierarchical structure early to avoid processing errors
  • HTML File Size: Large HTML files may load slowly. Consider filtering data or reducing hierarchy depth
  • Browser Performance: Use modern browsers for best performance. Clear cache if issues occur

Best Practices

  • Data Quality: Ensure hierarchical data is clean, nodes have valid names, and values are numeric
  • Data Format: Always validate hierarchical format and structure before visualization
  • Required Fields: Ensure name and value fields exist. Validate children structure is properly nested
  • Hierarchy Size: For large hierarchies (10K+ nodes), consider filtering or reducing depth
  • Color Schemes: Choose appropriate color schemes for your data type (Category20 for distinct, Viridis for continuous)
  • Error Handling: Add error handling in data functions to prevent crashes
  • Data Validation: Always validate hierarchical structure and types before processing
  • Export Formats: Use HTML for interactive sharing, JSON/CSV for data export
  • Visualization Types: Choose appropriate visualization types (tree maps for value comparison, sunburst for exploration)
  • Documentation: Document custom modifications and data sources
  • Testing: Test with different hierarchical data types and sizes
  • Sharing: HTML files are standalone and portable. Share via email, cloud storage, or web hosting

Use Cases and Applications

  • Organizational Charts: Visualize organizational structures, departments, and hierarchies
  • File System Visualization: Display file system structures and directory hierarchies
  • Sales Data Analysis: Analyze sales data by region, product, and category
  • Budget Analysis: Visualize budget allocation across departments and projects
  • Category Breakdown: Display category hierarchies and subcategories
  • Product Hierarchies: Show product categories, subcategories, and items
  • Geographic Data: Visualize geographic hierarchies (country, state, city)
  • Project Management: Display project structures and task hierarchies
  • Data Reporting: Generate comprehensive hierarchical data reports with visualizations
  • Educational Purposes: Learn hierarchical data visualization and tree map concepts

Performance Benchmarks

Expected performance for different hierarchy sizes:

Hierarchy Size Nodes Load Time Visualization Render Memory Usage
Small 10 - 100 < 1 second < 1 second < 50 MB
Medium 100 - 1K 1-2 seconds 1-3 seconds 50-150 MB
Large 1K - 10K 2-5 seconds 3-8 seconds 150-400 MB
Very Large 10K+ 5-15 seconds 8-20 seconds 400+ MB

Note: Performance depends on hardware, hierarchy complexity, and visualization type. Basic tree maps are faster than complex interactive visualizations. Consider data filtering for very large hierarchies.

System Requirements

Recommended system requirements for optimal performance:

Component Minimum Recommended Optimal
Python 3.8 3.9+ 3.10+
RAM 4 GB 8 GB 16 GB+
CPU 2 cores 4 cores 8+ cores
Storage 100 MB 500 MB 1 GB+
Browser Chrome 90+ Chrome 100+ Latest

Note: Tree maps run in browser. No GPU required. Performance scales with hierarchy size. HTML files are interactive and can be shared easily.

Real-World Examples & Use Cases | Tree Map Visualization Use Cases | Hierarchical Data Visualization Examples

Example 1: Basic Tree Map Visualization

Create hierarchical visualizations with tree maps and sunburst charts:

# 1. Load hierarchical data from tree_map_plotly import load_hierarchical_data from data_utils import load_json_data data = load_hierarchical_data() # Or: data = load_json_data('data/sample_hierarchical_data.json') # 2. Create basic tree map from tree_map_plotly import create_treemap_plotly fig1 = create_treemap_plotly(data, title='Tree Map') fig1.show() # 3. Create sunburst chart from sunburst_plotly import create_sunburst_chart fig2 = create_sunburst_chart(data, title='Sunburst Chart') fig2.show() # 4. Create icicle chart from advanced_visualizations import create_icicle_chart fig3 = create_icicle_chart(data, title='Icicle Chart') fig3.show() # 5. Analyze hierarchical structure # - Identify value distribution # - Find largest nodes # - Analyze hierarchy depth # - Evaluate data organization

Example 2: Statistics and Search Functionality

Analyze data statistics and search for specific nodes:

# Use Case: Statistics analysis and search functionality # 1. Load hierarchical data from tree_map_plotly import load_hierarchical_data from data_utils import get_node_statistics, search_in_data data = load_hierarchical_data() # 2. Get statistics stats = get_node_statistics(data) print(f"Total Value: {stats['total_value']}") print(f"Node Count: {stats['node_count']}") print(f"Mean Value: {stats['mean_value']:.2f}") print(f"Min Value: {stats['min_value']}, Max Value: {stats['max_value']}") # 3. Search for nodes search_results = search_in_data(data, 'Sales') print(f"Found nodes: {search_results}") # 4. Create visualization with search highlighting from advanced_visualizations import create_interactive_treemap fig = create_interactive_treemap(data, title="Tree Map with Search", colorscale='Viridis') fig.show() # 5. Analyze results # - Identify high-value nodes # - Evaluate data distribution # - Find specific nodes quickly # - Understand value hierarchy

Example 3: Dataset Comparison

Compare multiple datasets side-by-side:

# Use Case: Dataset comparison # 1. Load multiple datasets from data_utils import load_json_data from advanced_visualizations import create_comparison_visualization data1 = load_json_data('data/sample_hierarchical_data.json') # Organizational data2 = load_json_data('data/sales_data.json') # Sales data3 = load_json_data('data/file_system_data.json') # File system # 2. Compare datasets datasets = [data1, data2, data3] fig = create_comparison_visualization(datasets, titles=['Organizational', 'Sales', 'File System']) fig.show() # 3. Analyze statistics for each dataset from data_utils import get_node_statistics for i, data in enumerate(datasets): stats = get_node_statistics(data) print(f"Dataset {i}: Total={stats['total_value']}, Nodes={stats['node_count']}") # 4. Visualize comparison side-by-side from tree_map_plotly import create_treemap_plotly import plotly.graph_objects as go from plotly.subplots import make_subplots fig = make_subplots(rows=1, cols=3, subplot_titles=('Organizational', 'Sales', 'File System')) # Add tree maps to subplots fig.show() # 5. Analyze differences # - Compare data structures # - Evaluate value differences # - Understand hierarchy properties # - Identify patterns across datasets

Example 4: Advanced Filtering and Data Export

Filter data and export results:

# Use Case: Advanced filtering and data export # 1. Load hierarchical data from tree_map_plotly import load_hierarchical_data from data_utils import filter_data_by_value, save_json_data, hierarchical_to_csv data = load_hierarchical_data() # 2. Filter by value range filtered_data = filter_data_by_value(data, min_value=50, max_value=200) print(f"Filtered nodes: {len(filtered_data.get('children', []))}") # 3. Create visualization of filtered data from tree_map_plotly import create_treemap_plotly fig = create_treemap_plotly(filtered_data, title='Filtered Tree Map') fig.show() # 4. Export filtered data save_json_data(filtered_data, 'filtered_data.json') hierarchical_to_csv(filtered_data, 'filtered_data.csv') # 5. Use cases: # - Focus on high-value items # - Analyze specific value ranges # - Export filtered results # - Data subset analysis

Example 5: Comprehensive Tree Map Analysis

Comprehensive tree map analysis with all features:

# Use Case: Comprehensive tree map analysis # 1. Load hierarchical data from tree_map_plotly import load_hierarchical_data data = load_hierarchical_data() # 2. Get statistics from data_utils import get_node_statistics stats = get_node_statistics(data) print(f"Total Value: {stats['total_value']}") print(f"Node Count: {stats['node_count']}") print(f"Mean: {stats['mean_value']:.2f}") # 3. Search functionality from data_utils import search_in_data search_results = search_in_data(data, 'Sales') print(f"Found nodes: {search_results}") # 4. Filter data from data_utils import filter_data_by_value filtered = filter_data_by_value(data, min_value=50, max_value=200) # 5. Create multiple visualizations from tree_map_plotly import create_treemap_plotly from sunburst_plotly import create_sunburst_chart from advanced_visualizations import create_interactive_treemap fig1 = create_treemap_plotly(data, title='Tree Map') fig2 = create_sunburst_chart(data, title='Sunburst Chart') fig3 = create_interactive_treemap(data, title='Interactive Tree Map', colorscale='Plasma') # 6. Export data from data_utils import save_json_data, hierarchical_to_csv save_json_data(data, 'exported_data.json') hierarchical_to_csv(data, 'exported_data.csv') # 7. Use cases: # - Comprehensive hierarchical analysis # - Value distribution identification # - Data exploration and visualization # - Hierarchical structure assessment

Integration Examples | Database Integration | API Integration | Web Integration

Integration with Database

Load hierarchical data from SQL database:

# Load hierarchical data from SQL database import sqlite3 import pandas as pd from data_utils import csv_to_hierarchical from tree_map_plotly import create_treemap_plotly def load_hierarchical_from_db(dataset_id='dataset1'): """Load hierarchical data from SQL database.""" conn = sqlite3.connect('hierarchical_data.db') query = """ SELECT Department, SubDepartment, Value FROM organizational_data WHERE dataset_id = ? """ df = pd.read_sql_query(query, conn, params=[dataset_id]) conn.close() # Convert CSV format to hierarchical data = csv_to_hierarchical(df) return data # Load and create visualization data = load_hierarchical_from_db('dataset1') fig = create_treemap_plotly(data, title="Tree Map from Database") fig.write_html('tree_map_from_db.html') # For MySQL/PostgreSQL: # import mysql.connector # conn = mysql.connector.connect( # host='localhost', # user='username', # password='password', # database='hierarchical_db' # )

Integration with REST API

Load hierarchical data from REST API endpoint:

# Load hierarchical data from REST API import requests import json from data_utils import load_json_data from tree_map_plotly import create_treemap_plotly def load_hierarchical_from_api(): """Load hierarchical data from REST API.""" response = requests.get( 'https://api.example.com/hierarchical-data', headers={'Authorization': 'Bearer YOUR_TOKEN'} ) data = response.json() # Ensure required structure exists if 'name' in data and 'value' in data: return data else: raise ValueError("Invalid hierarchical data structure") return data # Load and create visualization data = load_hierarchical_from_api() fig = create_treemap_plotly(data, title="Tree Map from API") fig.write_html('tree_map_from_api.html') # For real-time updates, refresh data periodically: import time while True: data = load_hierarchical_from_api() fig = create_treemap_plotly(data, title="Live Tree Map") fig.write_html('tree_map_live.html') time.sleep(300) # Update every 5 minutes

Embedding Tree Maps in Web Pages

Embed interactive tree maps in existing websites:

# Embed Tree Map in Web Page: # Option 1: Direct HTML embedding # The generated HTML files are standalone and can be embedded: <iframe src="path/to/tree_map.html" width="100%" height="700px" frameborder="0"> </iframe> # Option 2: Use Plotly's HTML output from tree_map_plotly import load_hierarchical_data, create_treemap_plotly data = load_hierarchical_data() fig = create_treemap_plotly(data, title="My Tree Map") # Get HTML div and script html_div = fig.to_html(include_plotlyjs='cdn', div_id='treemap-div') # Embed in your HTML page: # <div id="treemap-div"></div> # <script>...plotly.js code...</script> # Option 3: Serve HTML files via web server # Place HTML files in web server directory # Access via: https://yourdomain.com/tree-maps/tree_map.html # Option 4: Use Flask/Django to serve tree maps from flask import Flask, send_file from tree_map_plotly import load_hierarchical_data, create_treemap_plotly app = Flask(__name__) @app.route('/treemap') def show_treemap(): data = load_hierarchical_data() fig = create_treemap_plotly(data, title="Tree Map") fig.write_html('static/tree_map.html') return send_file('static/tree_map.html')

Sharing Tree Maps

Share interactive tree maps with others:

# Sharing Tree Map Options: # 1. Share HTML files directly # - HTML files are standalone and portable # - Can be opened in any browser # - No server required # - Share via email, cloud storage, etc. # 2. Upload to web hosting # - Upload HTML files to web server # - Share URL with team members # - Files remain interactive # 3. Export data (for sharing) from tree_map_plotly import load_hierarchical_data from data_utils import save_json_data, hierarchical_to_csv data = load_hierarchical_data() save_json_data(data, 'tree_map_data.json') hierarchical_to_csv(data, 'tree_map_data.csv') # Use in presentations, reports, documents # 4. Use Plotly Chart Studio (optional) # Upload to Plotly Chart Studio for cloud hosting # fig.write_html('tree_map.html') # Then upload to chart-studio.plotly.com # 5. GitHub Pages # - Push HTML files to GitHub repository # - Enable GitHub Pages # - Share public URL

Contact Information | Support | Get Help | Contact RSK World

Get in Touch

Developer: Molla Samser
Designer & Tester: Rima Khatun

rskworld.in
help@rskworld.in support@rskworld.in
+91 93305 39277

License | Open Source License | Project License

This project is for educational purposes only. See LICENSE file for more details.

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer