matplotlib

Previous topic

pylab_examples example code: fancybox_demo.py

Next topic

pylab_examples example code: fancytextbox_demo.py

This Page

pylab_examples example code: fancybox_demo2.pyΒΆ

(Source code, png)

../../_images/fancybox_demo21.png
import matplotlib.patches as mpatch
import matplotlib.pyplot as plt

styles = mpatch.BoxStyle.get_styles()
spacing = 1.2

figheight = (spacing * len(styles) + .5)
fig1 = plt.figure(1, (4/1.5, figheight/1.5))
fontsize = 0.3 * 72

for i, stylename in enumerate(sorted(styles.keys())):
    fig1.text(0.5, (spacing * (float(len(styles)) - i) - 0.5)/figheight, stylename,
              ha="center",
              size=fontsize,
              transform=fig1.transFigure,
              bbox=dict(boxstyle=stylename, fc="w", ec="k"))
plt.draw()
plt.show()

Keywords: python, matplotlib, pylab, example, codex (see Search examples)