--- id: squarify version: "0.4.4" license: Apache License 2.0 license_treatment: permissive maintenance: aging --- # squarify — Pure Python implementation of the squarify treemap layout algorithm License: permissive · Maintenance: aging · Downloads: 279.7K/mo ## What it is and what it does Squarify is a pure Python implementation of the squarified treemap layout algorithm based on the academic work by Bruls, Huizing, and van Wijk. It takes a list of numeric values and a rectangular coordinate space, then computes the positions and dimensions of rectangles whose areas are proportional to the input values. The algorithm aims to produce rectangles with aspect ratios close to square, making treemaps more readable than naive approaches. The package provides three main functions: squarify() for basic rectangle computation, padded_squarify() for adding visual gaps between rectangles, and a plot() helper that generates Matplotlib-based visualizations. It also includes normalize_sizes() to scale input values to match the target area. The output is a list of dictionaries, each containing x, y, dx, and dy coordinates suitable for rendering with visualization libraries or custom applications. Use it for: - Generate treemap layouts for visualizing hierarchical data like file system sizes or organizational structures. - Compute rectangle coordinates for custom rendering in web-based visualization frameworks. - Create Matplotlib-based treemap plots with optional padding and custom colors for exploratory data analysis. - Normalize and layout data values to fit within a bounded rectangular space for dashboard displays. - Build interactive treemap visualizations by obtaining rectangle coordinates for further processing. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Computes treemap layout rectangles from a list of values using the squarified algorithm, suitable for visualizing hierarchical data as nested rectangles. Yes, if you need treemap layout computation. The package has no dependencies, installs easily, and solves a specific algorithmic problem well. The aging maintenance status is not a blocker for a stable, narrow-scope algorithm library, but verify that the implementation meets your precision or performance requirements before adopting it in production. ## Install pip install squarify uv add squarify poetry add squarify ## Installing squarify Before you install: Low install friction with no runtime dependencies. Maintenance is aging—last release was 2024-07-19, and the repository remains active and unarchived. License in practice: Licensed under Apache License 2.0, a permissive license that allows commercial and private use with minimal restrictions. Quickstart: import squarify values = [500, 433, 78, 25, 25, 7] values = squarify.normalize_sizes(values, 700, 433) rects = squarify.squarify(values, 0, 0, 700, 433) Verify before relying: - Whether the package works with Python versions older than 3.8 despite the description mentioning Python 2 compatibility. - Whether Matplotlib is required for all use cases or only when using the plot() helper function. - Performance characteristics and numerical precision of the implementation for large datasets. ## Package facts - License: Apache License 2.0 (permissive) - Python support: unspecified - Install friction: low - Maintenance: aging - Downloads: 279.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags treemap layout algorithm, squarified treemap, rectangle packing visualization, hierarchical data layout, treemap coordinate computation, data visualization rectangles, squarify algorithm, treemap-layout, data-visualization, algorithm [View on SkillFed](https://skillfed.io/packages/squarify) · [View on PyPI](https://pypi.org/project/squarify/)