Skip to content

Instantly share code, notes, and snippets.

@gillespilon
Last active August 24, 2023 21:11
Show Gist options
  • Save gillespilon/8025dffa18dfa63cd0e863e3e33a067e to your computer and use it in GitHub Desktop.
Save gillespilon/8025dffa18dfa63cd0e863e3e33a067e to your computer and use it in GitHub Desktop.
Remove the top and right spines of a matplotlib graph.
import matplotlib.axes as axes
def despine(ax: axes.Axes) -> None:
"Remove the top and right spines of a graph"
ax.spines[["top", "right"]].set_visible(b=False)
despine(ax=ax)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment