Metadata-Version: 2.4
Name: tooltree
Version: 0.1.1
Summary: functions for creating treemap data visualizations
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Dist: plotly>=6.3.0
Requires-Dist: polars>=1.33.1
Requires-Dist: toolstr>=0.9.11
Project-URL: Documentation, https://github.com/paradigmxyz/tooltree
Project-URL: Source, https://github.com/paradigmxyz/tooltree


# tooltree

functions for creating treemap data visualizations

## Installation

```bash
uv add tooltree
```

## Example Usage

The main API is just one function, `tooltree.plot_treemap()`

See `tooltree.plot_treemap()` for full list of options

#### Basic Treemap

```python
import tooltree

tooltree.plot_treemap(
    df=dataframe,
    levels=[grandparent_column, parent_column, name_column],
    metric=metric_column,
    root='Root Node Name',
)
```

#### Output as HTML

```python
import tooltree

tooltree.plot_treemap(
    df=dataframe,
    levels=[grandparent_column, parent_column, name_column],
    metric=metric_column,
    root='Root Node Name',
    html_path='path/to/save/treemap.html',
)
```

#### Output as PNG

```python
import tooltree

tooltree.plot_treemap(
    df=dataframe,
    levels=[grandparent_column, parent_column, name_column],
    metric=metric_column,
    root='Root Node Name',
    png_path='path/to/save/treemap.png',
)
```

#### Limit Number of Treemap Children

```python
import tooltree

tooltree.plot_treemap(
    df=dataframe,
    levels=[grandparent_column, parent_column, name_column],
    metric=metric_column,
    root='Root Node Name',
    max_children=10,
    min_child_fraction=0.01,
    max_root_children=5,
    min_root_child_fraction=0.001,
)
```

#### Other Options

```python
import tooltree

tooltree.plot_treemap(
    df=dataframe,
    levels=[grandparent_column, parent_column, name_column],
    metric=metric_column,
    root='Root Node Name',
    metric_format=toolstr_kwargs,
    height=1600,
    width=1200,
)
```

