Name | pydreamplet JSON |
Version |
1.0.15
JSON |
| download |
home_page | None |
Summary | A versatile Python toolkit for programmatically generating, manipulating, and assembling scalable vector graphics (SVG) images. |
upload_time | 2025-02-23 09:06:17 |
maintainer | None |
docs_url | None |
author | Marek Pilczuk |
requires_python | >=3.12 |
license | MIT |
keywords |
svg
graphics
design
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# pyDreamplet
**pyDreamplet** is a low-level library for SVG image generation — **perfect for creating beautiful data visualizations with Python**. Its intuitive API lets you build complex, scalable SVG graphics effortlessly, making it an ideal choice for projects ranging from simple charts to intricate visualizations.
## Features
- **Lightweight & Flexible:** Generate SVG images with minimal overhead.
- **Easy Integration:** Works seamlessly in Jupyter notebooks, scripts, or web applications.
- **Customizable:** Set any attribute on your SVG elements using simple keyword arguments.
- **No Heavy Dependencies:** Designed to work with just Python’s standard library (plus Pillow and IPython for additional features).
## Installation
Install pyDreamplet using your preferred package manager:
With poetry:
```schell
poetry add pydreamplet
```
With pip:
```schell
pip install pydreamplet
```
## Documentation
For complete documentation, tutorials, and API references, please visit [pyDreampled documentation](https://marepilc.github.io/pydreamplet/)
## Examples
### Multidimensional Visualization of Supplier Quality Performance
This example showcases a sophisticated, multidimensional SVG visualization that displays supplier quality performance metrics. In this visualization, data dimensions such as defect occurrences, defect quantity, and spend are combined to provide an insightful overview of supplier performance. The visualization uses color, shape, and layout to encode multiple measures, allowing users to quickly identify strengths and weaknesses across suppliers.

### Creative Coding
This example uses pyDreamplet to create an engaging animated visualization featuring a series of circles. The animation leverages dynamic properties like stroke color and radius, which are mapped using linear and color scales. Each circle’s position and size are animated over time, creating a pulsating, rotating effect that results in a visually striking pattern.

## Usage example
Here's a quick example of how to create a waffle chart using pyDreamplet:
```python
import pydreamplet as dp
from pydreamplet.colors import random_color
data = [130, 65, 108]
def waffle_chart(data, side=300, rows=10, cols=10, gutter=5, colors=["blue"]):
sorted_data = sorted(data, reverse=True)
while len(colors) < len(sorted_data):
colors.append(random_color())
svg = dp.SVG(side, side)
total_cells = rows * cols
total = sum(data)
proportions = [int(round(d / total * total_cells, 0)) for d in sorted_data]
print("Proportions:", proportions)
cell_side = (side - (cols + 1) * gutter) / cols
cell_group_map = []
for group_index, count in enumerate(proportions):
cell_group_map.extend([group_index] * count)
if len(cell_group_map) < total_cells:
cell_group_map.extend([None] * (total_cells - len(cell_group_map)))
paths = {i: "" for i in range(len(sorted_data))}
for i in range(total_cells):
col = i % cols
row = i // cols
x = gutter + col * (cell_side + gutter)
y = gutter + row * (cell_side + gutter)
group = cell_group_map[i]
if group is not None:
paths[group] += f"M {x} {y} h {cell_side} v {cell_side} h -{cell_side} Z "
for group_index, d_str in paths.items():
if d_str:
path = dp.Path(d=d_str, fill=colors[group_index])
svg.append(path)
return svg
svg = waffle_chart(data)
svg.display() # in jupyter notebook
svg.save("waffle_chart.svg")
```

## Contributing
I welcome contributions from the community! Whether you have ideas for new features, bug fixes, or improvements to the documentation, your **input is invaluable**.
- **Open an Issue:** Found a bug or have a suggestion? Open an issue on GitHub.
- **Submit a Pull Request:** Improve the code or documentation? I’d love to review your PR.
- **Join the Discussion:** Get involved in discussions and help shape the future of **pyDreamplet**.
## License
This project is licensed under the MIT License.
Raw data
{
"_id": null,
"home_page": null,
"name": "pydreamplet",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "svg, graphics, design",
"author": "Marek Pilczuk",
"author_email": "user@mp76.pl",
"download_url": "https://files.pythonhosted.org/packages/d8/3a/bbf29f7b51c70a618953811abd7bc0ff4dd458a355cbab3c61a2f6e1648b/pydreamplet-1.0.15.tar.gz",
"platform": null,
"description": "# pyDreamplet\n\n**pyDreamplet** is a low-level library for SVG image generation \u2014 **perfect for creating beautiful data visualizations with Python**. Its intuitive API lets you build complex, scalable SVG graphics effortlessly, making it an ideal choice for projects ranging from simple charts to intricate visualizations.\n\n## Features\n\n- **Lightweight & Flexible:** Generate SVG images with minimal overhead.\n- **Easy Integration:** Works seamlessly in Jupyter notebooks, scripts, or web applications.\n- **Customizable:** Set any attribute on your SVG elements using simple keyword arguments.\n- **No Heavy Dependencies:** Designed to work with just Python\u2019s standard library (plus Pillow and IPython for additional features).\n\n## Installation\n\nInstall pyDreamplet using your preferred package manager:\n\nWith poetry:\n\n```schell\npoetry add pydreamplet\n```\n\nWith pip:\n\n```schell\npip install pydreamplet\n```\n\n## Documentation\n\nFor complete documentation, tutorials, and API references, please visit [pyDreampled documentation](https://marepilc.github.io/pydreamplet/)\n\n## Examples\n\n### Multidimensional Visualization of Supplier Quality Performance\n\nThis example showcases a sophisticated, multidimensional SVG visualization that displays supplier quality performance metrics. In this visualization, data dimensions such as defect occurrences, defect quantity, and spend are combined to provide an insightful overview of supplier performance. The visualization uses color, shape, and layout to encode multiple measures, allowing users to quickly identify strengths and weaknesses across suppliers.\n\n\n\n### Creative Coding\n\nThis example uses pyDreamplet to create an engaging animated visualization featuring a series of circles. The animation leverages dynamic properties like stroke color and radius, which are mapped using linear and color scales. Each circle\u2019s position and size are animated over time, creating a pulsating, rotating effect that results in a visually striking pattern.\n\n\n\n## Usage example\n\nHere's a quick example of how to create a waffle chart using pyDreamplet:\n\n```python\nimport pydreamplet as dp\nfrom pydreamplet.colors import random_color\n\ndata = [130, 65, 108]\n\n\ndef waffle_chart(data, side=300, rows=10, cols=10, gutter=5, colors=[\"blue\"]):\n sorted_data = sorted(data, reverse=True)\n while len(colors) < len(sorted_data):\n colors.append(random_color())\n\n svg = dp.SVG(side, side)\n\n total_cells = rows * cols\n total = sum(data)\n proportions = [int(round(d / total * total_cells, 0)) for d in sorted_data]\n print(\"Proportions:\", proportions)\n\n cell_side = (side - (cols + 1) * gutter) / cols\n\n cell_group_map = []\n for group_index, count in enumerate(proportions):\n cell_group_map.extend([group_index] * count)\n\n if len(cell_group_map) < total_cells:\n cell_group_map.extend([None] * (total_cells - len(cell_group_map)))\n\n paths = {i: \"\" for i in range(len(sorted_data))}\n\n for i in range(total_cells):\n col = i % cols\n row = i // cols\n\n x = gutter + col * (cell_side + gutter)\n y = gutter + row * (cell_side + gutter)\n\n group = cell_group_map[i]\n if group is not None:\n paths[group] += f\"M {x} {y} h {cell_side} v {cell_side} h -{cell_side} Z \"\n\n for group_index, d_str in paths.items():\n if d_str:\n path = dp.Path(d=d_str, fill=colors[group_index])\n svg.append(path)\n\n return svg\n\n\nsvg = waffle_chart(data)\nsvg.display() # in jupyter notebook\nsvg.save(\"waffle_chart.svg\")\n```\n\n\n## Contributing\n\nI welcome contributions from the community! Whether you have ideas for new features, bug fixes, or improvements to the documentation, your **input is invaluable**.\n\n- **Open an Issue:** Found a bug or have a suggestion? Open an issue on GitHub.\n- **Submit a Pull Request:** Improve the code or documentation? I\u2019d love to review your PR.\n- **Join the Discussion:** Get involved in discussions and help shape the future of **pyDreamplet**.\n\n## License\n\nThis project is licensed under the MIT License.",
"bugtrack_url": null,
"license": "MIT",
"summary": "A versatile Python toolkit for programmatically generating, manipulating, and assembling scalable vector graphics (SVG) images.",
"version": "1.0.15",
"project_urls": null,
"split_keywords": [
"svg",
" graphics",
" design"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "194ad09821910754e15b413dae1fabf35b4eac9265a4df2390b09a250b692b35",
"md5": "2efaa1fe81ecb2f179d2e0f613cacf02",
"sha256": "01c9e7d71e3227361a1299cf6aa575c2b51fb0f1ad89107aa3ca9aa8842646c0"
},
"downloads": -1,
"filename": "pydreamplet-1.0.15-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2efaa1fe81ecb2f179d2e0f613cacf02",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 96435,
"upload_time": "2025-02-23T09:06:15",
"upload_time_iso_8601": "2025-02-23T09:06:15.171662Z",
"url": "https://files.pythonhosted.org/packages/19/4a/d09821910754e15b413dae1fabf35b4eac9265a4df2390b09a250b692b35/pydreamplet-1.0.15-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d83abbf29f7b51c70a618953811abd7bc0ff4dd458a355cbab3c61a2f6e1648b",
"md5": "328409d1721e9b26c5995ec5d7c919a2",
"sha256": "efd34a9e25872584e6acfb4053fcfad65e35486ab5756b26d037223bce304585"
},
"downloads": -1,
"filename": "pydreamplet-1.0.15.tar.gz",
"has_sig": false,
"md5_digest": "328409d1721e9b26c5995ec5d7c919a2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 94896,
"upload_time": "2025-02-23T09:06:17",
"upload_time_iso_8601": "2025-02-23T09:06:17.367383Z",
"url": "https://files.pythonhosted.org/packages/d8/3a/bbf29f7b51c70a618953811abd7bc0ff4dd458a355cbab3c61a2f6e1648b/pydreamplet-1.0.15.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-23 09:06:17",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pydreamplet"
}