Generate and visualize fractal patterns like Mandelbrot, Julia, Koch, Sierpinski, and L-Systems.
Project description
fractalplots 🧩
fractalplots is a Python package for generating and visualizing fractal patterns like the Mandelbrot set, Julia set, Koch snowflake, Sierpinski triangle, and L-system fractals. Each fractal can be generated with a single function call.
📦 Installation
Install from PyPI (after publishing):
pip install fractalplots
Or install from source:
git clone https://github.com/bhavykhatri/fractalplots.git
cd fractalplots
pip install -e .
🌀 Fractal Patterns
🟡 Mandelbrot Set
The Mandelbrot set is generated by checking which complex numbers remain bounded under a recurrence formula. It produces the iconic cardioid shape with infinite detail.
🟣 Julia Set
Julia sets are variations of the Mandelbrot fractal, defined using a fixed complex constant. Different constants produce different fractal "personalities".
❄️ Koch Snowflake
The Koch snowflake begins as an equilateral triangle. Each side is recursively replaced with a spike pattern, creating a snowflake boundary.
🔺 Sierpinski Triangle
A classic example of a recursive fractal made by repeatedly removing the center of a triangle. The pattern reveals a triangular lattice structure.
🌿 L-System Fractal
L-Systems (Lindenmayer Systems) use rewriting rules to simulate fractal growth like that of plants, corals, and trees.
✏️ Example Usage
Here’s how to generate and save a Mandelbrot image:
from fractalplots import generate_mandelbrot, plot_mandelbrot
div_time = generate_mandelbrot()
plot_mandelbrot(div_time, save_path="mandelbrot.png", show=False)
Every fractal module provides two functions:
generate_*: Computes data (e.g., image matrix or point list)plot_*: Renders or saves the fractal image
📁 Folder Structure
fractalplots/
├── fractalplots/
│ ├── mandelbrot.py
│ ├── julia.py
│ ├── koch.py
│ ├── sierpinski.py
│ ├── lsystem.py
│ └── __init__.py
├── examples/
├── tests/
├── assets/
│ └── *.png
├── README.md
├── LICENSE
└── pyproject.toml
🧪 Run Tests
To verify everything works:
pytest tests/
🤝 Contributing
Fractals are fun and there's room for more! Contributions are welcome — add new fractal types, optimize existing ones, or improve rendering. Fork the repo and open a pull request.
📄 License
MIT License © 2025 Bhavy Khatri
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fractalplots-0.1.2.tar.gz.
File metadata
- Download URL: fractalplots-0.1.2.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea8ce8115be1caa310b2a9dd2757cbcaa465144440fff844e31498b319e4c889
|
|
| MD5 |
2dec24f2b9454005e892e23c34c82057
|
|
| BLAKE2b-256 |
4a8cd59a8888f30a8063495966837fd65ac64c6d88ff471e6d2a75a8f6d5cd8a
|
File details
Details for the file fractalplots-0.1.2-py3-none-any.whl.
File metadata
- Download URL: fractalplots-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6982d7f521b82c6782ddc70b8d8a3e674cc31a32971403cfe35ea82fd6108b8
|
|
| MD5 |
ecc7ee390df3df77aaa92cfeb9c5f0f1
|
|
| BLAKE2b-256 |
71d03c502189904b3b86f29b7c51250489ef8b75adf4f2478dc070ba3c61e70d
|