The package will help MIPT students to draw graphs easier
Project description
Длинное описание, которое когда-то появится
Для сборки:
python -m pip install --upgrade build wheel
python -m build --no-isolation
twine upload dist/*
Для установки:
pip install -i https://test.pypi.org/simple/ miptlabs
Чтобы нарисовать что-то:
from miptlabs.plotter import pretty_plot, show
from numpy import linspace
# точки для построения графика
x = linspace(0, 5, 20)
y = x * x
pretty_plot(x, y)
show()
Точки можно просто соединить написав line=True:
pretty_plot(x, y, line=True, legend='$y = x^2$')
Так как для данный с лаб простое соединение вряд ли подойдет, то в пакете есть разные апроксиматоры Для примера можно взять зависимость координаты от рвемени при равноускоренном движении
from src.miptlabs.plotter import pretty_plot, show
from src.miptlabs.approximators import Polynomial
from numpy import linspace
import numpy as np
# точки для построения графика
x = linspace(0, 5, 20)
y = x * x + np.random.normal(size=x.shape)
ax = pretty_plot(x, y, legend='$x = t^2$ + random')
# Апроксимация
approximator = Polynomial(deg=2)
appr_x, appr_y = approximator.approximate(x, y)
# Вывод формулы для латеха
print(approximator.label('t', 'x'))
# >>> $y = 1.03t^{2}-0.205t+0.158$
№ Построение графика. Параметры говорят сами за себя
pretty_plot(appr_x, appr_y, axes=ax, points=False, line=True,
legend=approximator.label('t', 'x'), xlabel='t, сек', ylabel='x, м', title='График $x(t)$')
ax.figure.savefig('examples/approx.png')
show()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
miptlabs-1.0.13.tar.gz
(17.7 kB
view hashes)
Built Distribution
miptlabs-1.0.13-py3-none-any.whl
(22.0 kB
view hashes)
Close
Hashes for miptlabs-1.0.13-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcbad34d353c700f288a1b22cbff451f2414e9e7462679d7a34539df4dc872b3 |
|
MD5 | 1337bdd14d6f805b41682431faa4e669 |
|
BLAKE2b-256 | fd53f5de47a061d65916166187d44f5ac6c28d8ef9e17b5b86d32fe7a57dec43 |