Manage figures in your PythonTeX documents.
texfigure is a package of PythonTeX helpers for managing matplotlib plots.
Importing texfigure will set your matplotlib backend to pgf, therefore import texfigure should come before any other matplotlib imports.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.