You are reading an old version of the documentation (v1.4.0). For the latest version see

Previous topic

misc example code:

Next topic

mplot3d Examples

This Page

misc example code: tight_bbox_test.pyΒΆ

[source code]

from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np

ax = plt.axes([0.1, 0.3, 0.5, 0.5])

plt.yticks([0.5, 1.5], ["long long tick label",
                        "tick label"])
plt.ylabel("My y-label")
plt.title("Check saved figures for their bboxes")
for ext in ["png", "pdf", "svg", "svgz", "eps"]:
    print("saving tight_bbox_test.%s" % (ext,))
    plt.savefig("tight_bbox_test.%s" % (ext,), bbox_inches="tight")

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