Matplotlib Format Pi
Branches
Master
Version | Upload Status | Downloads |
---|
![PyPI](https://img.shields.io/pypi/v/matplot-fmt-pi?label=PyPi%20package) | ![Upload Python Package](https://github.com/k-donn/format-pi/actions/workflows/pythonpublish.yml/badge.svg) | ![PyPI - Downloads](https://img.shields.io/pypi/dm/matplot-fmt-pi?logo=pypi) |
Release
Format multiples of pi as strings on Matplotlib axes.
The MultiplePi
class creates a Locator to place ticks at desired multiples and a Formatter to format all tick labels.
The base (π or τ) can be divided by any Natural Number.
Multiples of one-π or one-τ can be placed/formatted too. (2π, 3π, 2τ, 3τ, etc.)
Installing
pip install matplot-fmt-pi
Examples
from matplot_fmt_pi.ticker import MultiplePi
Simply, the instance can be asssigned a denominator of pi then passed to matplotlib.
![Graph Example](https://raw.githubusercontent.com/k-donn/format-pi/master/examples/pi_graph.png)
The parameters can also be modified to adjust the output to something more sophisticated.
![Tau Graph Example](https://raw.githubusercontent.com/k-donn/format-pi/master/examples/tau_graph.png)
![Y-Axis Example](https://raw.githubusercontent.com/k-donn/format-pi/master/examples/pi_y_axis.png)
Running Examples
Clone, then from the repo,
cd examples/
python *.py
Put the repo's directory in the python path to import the matplot_fmt_pi
folder not the installed package.
PYTHONPATH=/home/user/py-pros/format-pi python examples/pi_graph.py
Todo
Meta
![PyPI - License](https://img.shields.io/pypi/l/matplot-fmt-pi)
Inspired by this post on StackOverflow.