Skip to content

Instantly share code, notes, and snippets.

View gillespilon's full-sized avatar
💭
datasense is my current project

Gilles Pilon gillespilon

💭
datasense is my current project
  • Ottawa ON + Chicago IL
View GitHub Profile
@gillespilon
gillespilon / def_despine.txt
Last active August 24, 2023 21:11
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)
@gillespilon
gillespilon / matplotlib_inlinebackend.txt
Last active August 24, 2023 21:21
Ensure inline graphs display in Jupyter Notebook using the matplotlib library.
# Add these lines after importing other modules
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format='svg'
# Put all of your graph code in one cell
# The last line of the cell displays the graph.
plt.show
# reference https://matplotlib.org/faq/usage_faq.html#what-is-a-backend