Skip to main content

The package will help MIPT students to draw graphs easier

Project description

Documentation Status

Длинное описание, которое когда-то появится

Для сборки:

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

base_graph

Точки можно просто соединить написав line=True:

pretty_plot(x, y, line=True, legend='$y = x^2$')

with_line_graph

Так как для данный с лаб простое соединение вряд ли подойдет, то в пакете есть разные апроксиматоры Для примера можно взять зависимость координаты от рвемени при равноускоренном движении

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

approx_graph

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

miptlabs-1.0.17.1.tar.gz (19.2 kB view hashes)

Uploaded Source

Built Distribution

miptlabs-1.0.17.1-py3-none-any.whl (24.2 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