Skip to content

Instantly share code, notes, and snippets.

@pierdom
Last active January 24, 2019 18:22
Show Gist options
  • Save pierdom/fccc8e0a8244e28aa11bfa2370813875 to your computer and use it in GitHub Desktop.
Save pierdom/fccc8e0a8244e28aa11bfa2370813875 to your computer and use it in GitHub Desktop.
[Matplotlib and Jupyter on Mac: rocket icon] Avoid Python rocket icon on Mac dock when running Python scripts that use Matplotlib (very frequent when running Jupyter Notebook). The problem occurs because Python thinks that something interactive (e.g., a GUI) is going on, while we are simply plotting in-line in Jupyter. The fix below tells Matplo…

Change import matplotlib.pyplot as plt to:

import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment