A simple, minimalistic Python library for creating eye-pleasing particle-based flow field visualizations from vector field data.
Figure generated with the Teaser notebook.
vfield makes it easy to create neat vector field renderings with:
📜 One simple script that fits ~200 lines of code, no other libraries
🎯 Full control over particle count, step count, and step size
🖌 Smooth rendering with built-in antialiasing
🎨 Custom color schemes to match your aesthetic
🚀 GPU acceleration for fast rendering on supported hardware
git clone https://github.com/erodola/vfield.git
cd vfield
uv venv
uv pip install -e .Verify with:
source .venv/bin/activate # macOS/Linux
# OR
.venv\Scripts\activate # Windows
python -c "import vfield; print('vfield installed successfully!')"from vfield import render_flow_field
import torch
# Load your vector field data
vfield = torch.load('data/vectorfield.pt')
grid = vfield['grid']
displacement = vfield['displacement']
# Render flow field
image = render_flow_field(
grid, displacement,
W=1920, H=1080,
particles=5000
)
image.save('output.png')See the notebooks/ directory for detailed examples:
- Python 3.11+
- PyTorch
- Matplotlib
- Pillow
MIT License - see LICENSE file for details.
