[ Web Proxy ]
URL:
Viewing: https://matplotlib.org/stable/api/_as_gen/../../gallery/misc/../misc/../color/../misc/fig_x.html [Back]  [Original]

Add lines directly to a figure — Matplotlib 3.11.2 documentation
Back to top
Search the docs ...:

Add lines directly to a figure#

You can add artists such as a Line2D directly to a figure. This is typically useful for visual structuring.

import matplotlib.pyplot as plt

import matplotlib.lines as lines

fig, axs = plt.subplots(2, 2, gridspec_kw={'hspace': 0.4, 'wspace': 0.4})
fig.add_artist(lines.Line2D([0, 1], [0.47, 0.47], linewidth=3))
fig.add_artist(lines.Line2D([0.5, 0.5], [1, 0], linewidth=3))
plt.show()
fig x [fig x]

References

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

Gallery generated by Sphinx-Gallery


Web Proxy Viewer  |  New URL  |  Original Page