How to have consistency between different matplotlib backends?

Different matplotlib backends behave slightly differently, resulting in different behavior when plots are rendered from Jupyter Notebook vs a command-line script.

If you are missing x-ticks or y-ticks, try creating a new figure for each plot.

fig, ax = plt.subplots()

If you are getting an PathPatch AttributeError, you can safely ignore the exception.

try:
    ....
except AttributeError:
    pass