Skip to main content

Plotting functions for physical fields.

Project description

plofeld

"One of these days we must invent a faster-working field plotter!"


plofeld is a python plotting library for physical fields.

Installing

Installation is easily done via pip:

pip install plofeld

required are numpy, scipy, pandas, matplotlib.

Usage

First one needs to place some Elements, in this example PointCharges around your coordinate system. The positions of these Elements need to be given in Vectors.

This list is then passed on to the StaticField class, which creates the field.

The field can then be plotted with the StaticField().plot() function.

from matplotlib import pyplot as plt

from plofeld.elements import PointCharge
from plofeld.fields import StaticField
from plofeld.utils.classes import Vector
from plofeld.utils.constants import ELECTRIC


def plot_two_charges():
    charges = [
        PointCharge(Vector(x=1, y=0), q=-1),
        PointCharge(Vector(x=-1, y=0), q=1),
    ]

    field = StaticField(charges, field_type=ELECTRIC)
    field.plot(xlim=(-2, 2), ylim=(-2, 2))

    plt.show()


if __name__ == '__main__':
    plot_two_charges()

This code and more can be found in the examples folder.

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

plofeld-0.0.1.tar.gz (6.0 kB view hashes)

Uploaded Source

Built Distribution

plofeld-0.0.1-py3-none-any.whl (6.4 kB view hashes)

Uploaded Python 3

Supported by

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