[[ https://matplotlib.org/ | Matplotlib Home ]]
====== Backend ======
* Show current backend
import matplotlib
matplotlib.pyplot.get_backend()
# or
matplotlib.rcParams['backend']
* Setup backend
import matplotlib
matplotlib.use('GTKAgg')
* Show all possible backends
import matplotlib
matplotlib.rcsetup.interactive_bk
matplotlib.rcsetup.non_interactive_bk
matplotlib.rcsetup.all_backends
====== Troubleshooting ======
* When close a figure window, the following information jump out:
/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk.py:253: Warning: Source ID 70 was not found when attempting to remove it
gobject.source_remove(self._idle_event_id)
The solution is to modify /usr/lib/python2.7/dist-packages/matplotlib/backend_bases.py by adding "return True" to the end of function "def idle_event(self, guiEvent=None):". [[https://github.com/matplotlib/matplotlib/pull/3769 | Ref]]
*When want to modify the font types of labels,titles...[[https://stackoverflow.com/questions/21321670/how-to-change-fonts-in-matplotlib-python |Ref]]
csfont = {'fontname':'Comic Sans MS'}
hfont = {'fontname':'Helvetica'}
plt.title('title',**csfont)
plt.xlabel('xlabel', **hfont)
plt.show()