Skip to main content

License Python Version PyPI Version Codeberg Release Downloads Code Style: black Ruff ty
pre-commit PyTest Publish
Codeberg Issues Codeberg PRs Codeberg Stars Source Code

gypt_matplotlib

A small addon for matplotlib that can be used for the GYPT.



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$

Metadata

Release files for gypt_matplotlib 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gypt_matplotlib 0.7.0
File Size Uploaded
gypt_matplotlib-0.7.0.tar.gz 19.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gypt_matplotlib 0.7.0
File Interpreter ABI Platform
gypt_matplotlib-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 37.9 kB

Release files / gypt_matplotlib-0.7.0.tar.gz

Download URL gypt_matplotlib-0.7.0.tar.gz
Size 19.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1203cbf000fadf580267d6cbe21ab8fdff6fb3f2974beb017fe5d8324dcf6d36
BLAKE2b-256 checksum
How to use checksums
9c8dc9a7efc8ffc3b556eb9948c7875bcceb5a0bb2330f8f70d6ed8fa49ae448
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.12.12 Linux/6.12.57+deb13-amd64

Release files / gypt_matplotlib-0.7.0-py3-none-any.whl

Download URL gypt_matplotlib-0.7.0-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ddb8b960211c10d583da9ed3b9f68ef8a1606d7d814e53151f49c1da9df8907
BLAKE2b-256 checksum
How to use checksums
18cc5333cfcae53e848bcb13996a1e17fda5c5c4e4b3a6e4e5d33647930b8070
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.12.12 Linux/6.12.57+deb13-amd64

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page