FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Clean up and move accented text example by dstansby · Pull Request #8065 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (4) All 1 file type selected
Deleted files Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
21 changes: 0 additions & 21 deletions examples/pylab_examples/accented_text.py

This file was deleted.

2 changes: 1 addition & 1 deletion examples/tests/backend_driver.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
]

files['text_labels_and_annotations'] = [
'accented_text.py',
'text_demo_fontdict.py',
'unicode_demo.py',
]
Expand All @@ -109,7 +110,6 @@
]

files['pylab'] = [
'accented_text.py',
'alignment_test.py',
'annotation_demo.py',
'annotation_demo.py',
Expand Down
37 changes: 37 additions & 0 deletions examples/text_labels_and_annotations/accented_text.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
r"""
=================================
Using accented text in matplotlib
=================================

Matplotlib supports accented characters via TeX mathtext or unicode.

Using mathtext, the following accents are provided: \hat, \breve, \grave, \bar,
\acute, \tilde, \vec, \dot, \ddot. All of them have the same syntax,
e.g., to make an overbar you do \bar{o} or to make an o umlaut you do
\ddot{o}. The shortcuts are also provided, e.g.,: \"o \'e \`e \~n \.x
\^y
"""
from __future__ import unicode_literals
import matplotlib.pyplot as plt

# Mathtext demo
fig, ax = plt.subplots()
ax.plot(range(10))
ax.set_title(r'$\ddot{o}\acute{e}\grave{e}\hat{O}'
r'\breve{i}\bar{A}\tilde{n}\vec{q}$', fontsize=20)

# Shorthand is also supported and curly braces are optional
ax.set_xlabel(r"""$\"o\ddot o \'e\`e\~n\.x\^y$""", fontsize=20)
ax.text(4, 0.5, r"$F=m\ddot{x}$")
fig.tight_layout()

# Unicode demo
fig, ax = plt.subplots()
ax.set_title("GISCARD CHAHUTÉ À L'ASSEMBLÉE")
ax.set_xlabel("LE COUP DE DÉ DE DE GAULLE")
ax.set_ylabel('André was here!')
ax.text(0.2, 0.8, 'Institut für Festkörperphysik', rotation=45)
ax.text(0.4, 0.2, 'AVA (check kerning)')

plt.show()
16 changes: 0 additions & 16 deletions examples/text_labels_and_annotations/unicode_demo.py

This file was deleted.


Back | FazBrowse Home | New Git URL