Note
Click here to download the full example code
Adding lines to a figure without any axes.
=======================
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()
Traceback (most recent call last):
File "/build/matplotlib-tq5J6U/matplotlib-3.1.2/examples/pyplots/fig_x.py", line 1
=======================
^
SyntaxError: invalid syntax
The use of the following functions, methods, classes and modules is shown in this example:
import matplotlib
matplotlib.pyplot.figure
matplotlib.lines
matplotlib.lines.Line2D
Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery