跳转到主要内容

物理场绘图函数。

项目描述

plofeld

"总有一天我们必须发明一个更快工作的场绘图器!"


plofeld 是一个用于物理场的Python绘图库。

安装

安装可以通过 pip 容易完成

pip install plofeld

需要 numpy, scipy, pandas, matplotlib

使用

首先需要放置一些 Elements,在这个例子中是 PointCharges 在您的坐标系周围。这些 Elements 的位置需要以 Vectors 的形式给出。

然后将此列表传递给 StaticField 类,该类创建场。

然后可以使用 StaticField().plot() 函数绘制场。

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()

更多代码可以在 examples 文件夹中找到。

项目详情


下载文件

下载适用于您平台文件。如果您不确定要选择哪个,请了解有关 安装包 的更多信息。

源分发

plofeld-0.0.1.tar.gz (6.0 kB 查看哈希值)

上传于 源码

构建版本

plofeld-0.0.1-py3-none-any.whl (6.4 kB 查看哈希值)

上传于 Python 3

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面