Axis line stylesΒΆ

This example shows some configurations for axis style.

Note: The mpl_toolkits.axisartist axes classes may be confusing for new users. If the only aim is to obtain arrow heads at the ends of the axes, rather check out the Centered spines with arrows example.

demo axisline style
from mpl_toolkits.axisartist.axislines import SubplotZero
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax = SubplotZero(fig, 111)

for direction in ["xzero", "yzero"]:
    # adds arrows at the ends of each axis

    # adds X and Y-axis from the origin

for direction in ["left", "right", "bottom", "top"]:
    # hides borders

x = np.linspace(-0.5, 1., 100)
ax.plot(x, np.sin(x*np.pi))

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