Skip to content

Add treemaps - #854

Open
cvanelteren wants to merge 4 commits into
mainfrom
feat/treemap
Open

cvanelteren wants to merge 4 commits into
mainfrom
feat/treemap

Conversation

@cvanelteren

Copy link
Copy Markdown
Collaborator

Closes #458 by adding ax.treemap() for flat and nested dictionaries, pandas Series, and DataFrame columns via data=df. No additional dependencies are required.

Tile areas represent values. Nested dictionaries create labeled groups with related colors. Explicit colors, colormaps, colorbars, value labels, and artist styling are supported.

# Flat categories
ax.treemap({"Solar": 36, "Wind": 28, "Hydro": 18}, show_values=True)

# Nested groups
ax.treemap({
    "Research": {"Fieldwork": 24, "Equipment": 16},
    "People": {"Staff": 20, "Training": 10},
})

# DataFrame columns
artists = ax.treemap("budget", labels="category", data=df, cmap="viridis")
ax.colorbar(artists["mappable"], label="Budget")

@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.97733% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ultraplot/axes/plot_types/treemap.py 93.93% 6 Missing and 6 partials ⚠️

📢 Thoughts on this report? Let us know!

@cvanelteren
cvanelteren marked this pull request as draft November 3, 2026 04:15
@cvanelteren
cvanelteren marked this pull request as ready for review November 3, 2026 05:02

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Add Treemap

1 participant