Skip to main content

Label lines in matplotlib.

Project description

Copyright (c) 2017 Corentin Cadiou

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Description: # matplotlib-label-lines
Label line using matplotlib.

From http://stackoverflow.com/questions/16992038/inline-labels-in-matplotlib

## Install

Just do:
```bash
pip install matplotlib-label-lines
```
and then:
```python
from matplotlib import pyplot as plt
from scipy.stats import loglaplace,chi2

from labellines import labelLine, labelLines

X = np.linspace(0,1,500)
A = [1,2,5,10,20]
funcs = [np.arctan,np.sin,loglaplace(4).pdf,chi2(5).pdf]

plt.subplot(221)
for a in A:
plt.plot(X,np.arctan(a*X),label=str(a))

labelLines(plt.gca().get_lines(),zorder=2.5)

plt.subplot(222)
for a in A:
plt.plot(X,np.sin(a*X),label=str(a))

labelLines(plt.gca().get_lines(),align=False,fontsize=14)

plt.subplot(223)
for a in A:
plt.plot(X,loglaplace(4).pdf(a*X),label=str(a))

xvals = [0.8,0.55,0.22,0.104,0.045]
labelLines(plt.gca().get_lines(),align=False,xvals=xvals,color='k')

plt.subplot(224)
for a in A:
plt.plot(X,chi2(5).pdf(a*X),label=str(a))

lines = plt.gca().get_lines()
l1=lines[-1]
labelLine(l1,0.6,label=r'$Re=${}'.format(l1.get_label()),ha='left',va='bottom',align = False)
labelLines(lines[:-1],align=False)

plt.show()
```

Platform: UNKNOWN

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

matplotlib-label-lines-0.3.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

matplotlib_label_lines-0.3.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

matplotlib_label_lines-0.3.0-py2-none-any.whl (5.7 kB view details)

Uploaded Python 2

File details

Details for the file matplotlib-label-lines-0.3.0.tar.gz.

File metadata

File hashes

Hashes for matplotlib-label-lines-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2899dc360404a4f83a18bb3ad7907e4191272e3c7fe9d4ae4d29733a01df950a
MD5 5fccf7f87b10967e99b723742a704d34
BLAKE2b-256 ab98fbe52716e85b306660640ec4f5cf1755bffaf3c26b6c982a343ff4eb2a2b

See more details on using hashes here.

File details

Details for the file matplotlib_label_lines-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for matplotlib_label_lines-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b628100f483286c71bf0dd4d25c7820767229ad2d9f933fff7956c919d23d145
MD5 6aabaf36ebbd362abe7198a52f8e58f1
BLAKE2b-256 f41357cef13d3cf5cf81a0d0906c433a7d1eb57eec51b6028e203a49a47bb483

See more details on using hashes here.

File details

Details for the file matplotlib_label_lines-0.3.0-py2-none-any.whl.

File metadata

File hashes

Hashes for matplotlib_label_lines-0.3.0-py2-none-any.whl
Algorithm Hash digest
SHA256 64e0574f850e4af003fa885d6f4976d6a29d0b135779bc1c6fd035945385220c
MD5 1c214ae194721e96025aceab69a60209
BLAKE2b-256 2795391e104fb27e0519c598d28cfa94657cb371ba78c75f3b6e486fee9210cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page