The package will help MIPT students to draw graphs easier
Project description
Длинное описание, которое когда-то появится
Для сборки:
python -m pip install --upgrade build wheel twine
python -m pip install -r requirements.txt
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file miptlabs-1.0.17.1.tar.gz.
File metadata
- Download URL: miptlabs-1.0.17.1.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a362a640f6ca04cf9178840d54c1529400c158bbb59a2e5c30d9b52f68b7b42c
|
|
| MD5 |
490ad8af0a8dba289c2b0c8d765ec2e2
|
|
| BLAKE2b-256 |
71acbd9460b9d805dd2cc4aecb73b9805759e4f1c68757cbd7b817714358210a
|
File details
Details for the file miptlabs-1.0.17.1-py3-none-any.whl.
File metadata
- Download URL: miptlabs-1.0.17.1-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f67a481c184ce94ff182997357d88409c33e2780f9fc367b4c51074d32441a8
|
|
| MD5 |
12caa8e57ab50626230752e12ef705f3
|
|
| BLAKE2b-256 |
60a7978d7b22b1fbcff26247e065fbc3f161814b16600a3965d4a0cf77b4c0f7
|