A small addon for matplotlib that can be used for the GYPT.
Project description
gypt_matplotlib
A small addon for matplotlib that can be used for the GYPT.
[!NOTE] To install
gypt-matplotlib, simply usepip.pip install gypt_matplotlib
GYPT?
GYPT stands for German Young Physicists’ Tournament.
Further information can be found at gypt.org.
I'm a participant of the GYPT. Can I contribute?
Of course, you can. Even if you are just a former participant, you are welcome. In fact, everyone is welcome to contribute or ask for features!
Simply open an issue and say what you would like to do so that details can be clarified directly.
Where did you get the stylesheet?
It's available over here at the GYPT wiki.
How to use:
Applying GYPT-stylesheet
Just import the library. The stylesheet will be automatically applied.
import gypt_matplotlib as gypt
Creating plots with a.u. (arbitrary units)
You can use the context manager gypt.au_plot()
to create plots where the concept and not the actual numbers are important.
import matplotlib.pyplot as plt
import gypt_matplotlib as gypt
with gypt.au_plot():
plt.title("Demo of plot without numbers on X-/Y-Axis.")
plt.show()
# or even more advanced:
with gypt.au_plot(), gypt.auto_save_and_show("path/to/file.png"):
plt.title("Demo of plot without numbers on X-/Y-Axis.")
Using other diverse context managers
import matplotlib.pyplot as plt
import gypt_matplotlib as gypt
with gypt.auto_close():
# This context manager automatically calls ``plt.close()``.
# Saving and displaying have to be done manually!
...
with gypt.auto_show():
# This context manager automatically calls ``plt.show()`` and ``plt.close()``.
# It's incompatible with ``gypt.auto_save()``! Use ``gypt.auto_save_and_show()`` instead!
...
with gypt.auto_save("path/to/file.png"):
# This context manager automatically calls ``plt.savefig()`` and ``plt.close()``.
# It's incompatible with ``gypt.auto_show()``! Use ``gypt.auto_save_and_show()`` instead!
...
with gypt.auto_save_and_show("path/to/file.png"):
# This context manager automatically calls ``plt.savefig()``, ``plt.show()`` and ``plt.close()``.
...
Using utils
This library offers multiple utilities which can be used. The following utils are included:
axes_label
import gypt_matplotlib as gypt
# with a unit
print(gypt.axes_label("v", unit=r"\frac{m}{s}")) # $v$ in $\frac{m}{s}$
# with arbitrary unit
print(gypt.axes_label("I", is_au=True)) # $I$ in $\text{a.u.}$
tex
import gypt_matplotlib as gypt
print(gypt.tex(r"e^{i\pi}+1=0")) # $e^{i\pi}+1=0$
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 gypt_matplotlib-0.7.0.tar.gz.
File metadata
- Download URL: gypt_matplotlib-0.7.0.tar.gz
- Upload date:
- Size: 19.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.12.57+deb13-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1203cbf000fadf580267d6cbe21ab8fdff6fb3f2974beb017fe5d8324dcf6d36
|
|
| MD5 |
0182fa8aec1a026dc5f6551f7b83d09a
|
|
| BLAKE2b-256 |
9c8dc9a7efc8ffc3b556eb9948c7875bcceb5a0bb2330f8f70d6ed8fa49ae448
|
File details
Details for the file gypt_matplotlib-0.7.0-py3-none-any.whl.
File metadata
- Download URL: gypt_matplotlib-0.7.0-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.12.57+deb13-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ddb8b960211c10d583da9ed3b9f68ef8a1606d7d814e53151f49c1da9df8907
|
|
| MD5 |
78c101d37c7b29209e3ae2145a6ba8d6
|
|
| BLAKE2b-256 |
18cc5333cfcae53e848bcb13996a1e17fda5c5c4e4b3a6e4e5d33647930b8070
|