Skip to main content

Generate and visualize fractal patterns like Mandelbrot, Julia, Koch, Sierpinski, and L-Systems.

Project description

FractalGen 🧩

FractalGen 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 fractalgen

Or install from source:

git clone https://github.com/bhuwankhatri/fractalgen.git
cd fractalgen
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 fractalgen 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

fractalgen/
├── fractalgen/
│   ├── 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 Bhuwan Khatri

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fractalplots-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fractalplots-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file fractalplots-0.1.0.tar.gz.

File metadata

  • Download URL: fractalplots-0.1.0.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

Hashes for fractalplots-0.1.0.tar.gz
Algorithm Hash digest
SHA256 40e403965abd407ba2b4a8bea4a8330b06b1fb178b643dec1f7e8839230c5122
MD5 86cd704c278e85d0ce32d4c1a8627b28
BLAKE2b-256 75f0de4dc8efc58948726f4e305d2e1d96e75b7cb60946dcfdf4de0e05ff7345

See more details on using hashes here.

File details

Details for the file fractalplots-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fractalplots-0.1.0-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

Hashes for fractalplots-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1677fbcd39c1a382d5ab5c3b1021da809d3dc3079f0944b9d25794e665a01d3d
MD5 8ae4508cd01f0ab22a418eac874ad94d
BLAKE2b-256 0fcdc9a299ea0b718b262d5c45ac1e1886e00e08e97a50183d3be2b666b5f24e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page