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/bhavykhatri/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 Bhavy 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.1.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.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fractalplots-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 eb95a78240b8357f395e01553c07aa0c983a68e41fa3bd50dca238cc7e8289f6
MD5 6a5252fc633f7065e8d482cefd9f1405
BLAKE2b-256 2f50a5c3472b4c060967a5420fd27573687bf53939f329d7c24b8610da1016bb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fractalplots-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b425e4a2ea668c3c6a87d93c271169c644055d20ef84dab4a30d532d4a69811e
MD5 83a103dc655d8417e55552e24b878b5a
BLAKE2b-256 d64c91d5fe920ea8e3bd65c6fb3013d49a7e531ea11b656fbcd218952c94c0ef

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