You are reading an old version of the documentation (v3.1.3). For the latest version see https://matplotlib.org/stable/gallery/pyplots/fig_x.html
Version 3.1.3
matplotlib
Fork me on GitHub

Table of Contents

Related Topics

Adding lines to figures

Adding lines to a figure without any axes.

import matplotlib.pyplot as plt
import matplotlib.lines as lines


fig = plt.figure()
fig.add_artist(lines.Line2D([0, 1], [0, 1]))
fig.add_artist(lines.Line2D([0, 1], [1, 0]))
plt.show()
../../_images/sphx_glr_fig_x_001.png

References

The use of the following functions, methods, classes and modules is shown in this example:

Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery