Metadata-Version: 2.4
Name: mosaicmap
Version: 0.1.4
Summary: A Python library for creating treemaps with images
Project-URL: Homepage, https://github.com/eric-langenberg/mosaic-map
Project-URL: Bug Tracker, https://github.com/eric-langenberg/mosaicmap/issues
Author-email: Eric Langenberg <eric-langenberg@users.noreply.github.com>
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.7
Requires-Dist: numpy>=1.20.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: pillow>=9.0.0
Requires-Dist: squarify>=0.4.3
Description-Content-Type: text/markdown

# MosaicMap

A Python library for creating treemaps where rectangles are replaced with images. Perfect for visualizing comparisons and part-to-whole relationships with striking visuals.

## Installation

```bash
pip install mosaicmap
```

## Features

- Create treemaps using local images
- Two image fitting modes: 'crop' and 'stretch'
- Simple and intuitive API
- Customizable output size, background color, and labels

## Example Ouptut
This example shows cities sized by time spent:

![Example Output](https://raw.githubusercontent.com/eric-langenberg/mosaic-map/refs/heads/main/resources/example_output.jpg)

## Usage

```python
from mosaicmap import MosaicMap

# Initialize mosaicmap creator
mosaicmap = MosaicMap()

# Prepare your data
data = {
    'labels': ['Product A', 'Product B', 'Product C'],
    'values': [500, 300, 200],  # Size values for each rectangle
    'image_paths': ['path/to/image1.jpg', 'path/to/image2.jpg', 'path/to/image3.jpg']
}

# Create the mosaicmap
mosaicmap.create(
    data=data,
    output_path='output_mosaicmap.png',
    image_mode='crop',  # or 'stretch'
    width=800,
    height=600,
    background_color=(255, 255, 255),  # white
    show_labels=True,  # Enable labels, False by default
    font_size=16  # Optionally adjust font size
)
```

## Image Modes

- **crop**: Maintains image aspect ratio by cropping excess portions
- **stretch**: Stretches or compresses images to fit exactly in their allocated rectangles

## Requirements

- Python 3.7+
- Pillow
- numpy
- squarify
- pandas

## Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

This project is licensed under the MIT License - see the LICENSE file for details.
