(TIL) Matplotlib: Get current axis

less than 1 minute read

matplotlib.pyplot.gca(**kwargs) gets the current Axes instance on the current figure matching the given keyword args, or create one.

import matplotlib.pyplot as plt

fig = plt.figure()
ax = plt.gca()
ax.scatter(x, y)

Via StackOverflow.

Comments