Demoviz Documentation
Demoviz is a Python library for creating demographic visualizations using human vector icons. It provides scatter plots where data points are represented by human icons (male, female, baby) that can be colored and sized according to demographic data.
Features
Human icons: Male, female, and baby icons for demographic representation
Flexible coloring: Color icons by demographic variables
Scalable icons: Adjustable icon sizes and zoom levels
Matplotlib integration: Works seamlessly with matplotlib plots
Easy to use: Simple API for creating demographic visualizations
Quick Start
Installation
pip install demoviz
Basic Usage
import numpy as np
import matplotlib.pyplot as plt
from demoviz import DemoScatter
# Create sample data
ages = [0, 6, 12, 18, 24] # Age in months
weights = [3.5, 7.0, 9.5, 11.0, 12.5] # Weight in kg
# Create the plot
fig, ax = plt.subplots(figsize=(8, 6))
# Initialize DemoScatter with baby icons
demo = DemoScatter(icon_size=40, zoom=0.4)
# Plot babies with baby icons
demo.plot(ax, ages, weights, icon_type='baby', colors='lightblue')
# Customize the plot
ax.set_xlabel('Age (months)')
ax.set_ylabel('Weight (kg)')
ax.set_title('Baby Growth Chart')
ax.grid(True, alpha=0.3)
plt.tight_layout()
plt.show()
Available Icon Types
'baby'
,'child'
,'infant'
- Baby/child icons'male'
,'person'
- Male icons'female'
,'woman'
- Female icons
Examples
The library comes with several examples demonstrating different use cases:
Baby growth charts: Visualizing pediatric health data
Demographic change: Population changes over time
Disease analysis: Health outcome visualization
Model performance: ML model results with baby icons
API Reference
Examples and Tutorials
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.
Acknowledgments
The icons used in this library are retrieved from Wikimedia Commons:
Female icon: Woman (958542) - The Noun Project.svg
Male icon: Person icon BLACK-01.svg
Baby icon: Baby (75158) - The Noun Project.svg