Skip to main content

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.

Mandelbrot


🟣 Julia Set

Julia sets are variations of the Mandelbrot fractal, defined using a fixed complex constant. Different constants produce different fractal "personalities".

Julia


❄️ Koch Snowflake

The Koch snowflake begins as an equilateral triangle. Each side is recursively replaced with a spike pattern, creating a snowflake boundary.

Koch


🔺 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.

Sierpinski


🌿 L-System Fractal

L-Systems (Lindenmayer Systems) use rewriting rules to simulate fractal growth like that of plants, corals, and trees.

L-System


✏️ 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

Metadata

Release files for fractalplots 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fractalplots 0.1.2
File Size Uploaded
fractalplots-0.1.2.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fractalplots 0.1.2
File Interpreter ABI Platform
fractalplots-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.9 kB

Release files / fractalplots-0.1.2.tar.gz

Download URL fractalplots-0.1.2.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ea8ce8115be1caa310b2a9dd2757cbcaa465144440fff844e31498b319e4c889
BLAKE2b-256 checksum
How to use checksums
4a8cd59a8888f30a8063495966837fd65ac64c6d88ff471e6d2a75a8f6d5cd8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / fractalplots-0.1.2-py3-none-any.whl

Download URL fractalplots-0.1.2-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6982d7f521b82c6782ddc70b8d8a3e674cc31a32971403cfe35ea82fd6108b8
BLAKE2b-256 checksum
How to use checksums
71d03c502189904b3b86f29b7c51250489ef8b75adf4f2478dc070ba3c61e70d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page