| [ Web Proxy ] |
| Viewing: https://matplotlib.org/stable/api/_as_gen/../../gallery/style_sheets/../spines/spines_dropped.html | [Back] [Original] |
Section Navigation
fill_between with transparencyhisttype settingsplt.subplotsfloating_axes featuresNote
Go to the end to download the full example code.
Demo of spines offset from the axes (a.k.a. "dropped spines").
[spines dropped]import matplotlib.pyplot as plt
import numpy as np
def adjust_spines(ax, visible_spines):
ax.label_outer(remove_inner_ticks=True)
ax.grid(color='0.9')
for loc, spine in ax.spines.items():
if loc in visible_spines:
spine.set_position(('outward', 10)) # outward by 10 points
else:
spine.set_visible(False)
x = np.linspace(0, 2 * np.pi, 100)
fig, axs = plt.subplots(2, 2)
axs[0, 0].plot(x, np.sin(x))
axs[0, 1].plot(x, np.cos(x))
axs[1, 0].plot(x, -np.cos(x))
axs[1, 1].plot(x, -np.sin(x))
adjust_spines(axs[0, 0], ['left'])
adjust_spines(axs[0, 1], [])
adjust_spines(axs[1, 0], ['left', 'bottom'])
adjust_spines(axs[1, 1], ['bottom'])
plt.show()
Copyright 20022012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 20122026 The Matplotlib development team.
Created using Sphinx 9.1.0.
Built from v3.11.2-1-g879ad8ebba.
Built with the PyData Sphinx Theme 0.16.1.
| Web Proxy Viewer | New URL | Original Page |