How do you determine which backend is being used by matplotlib?

前端 未结 2 408
轻奢々
轻奢々 2020-12-02 14:18

Either interactively, such as from within an Ipython session, or from within a script, how can you determine which backend is being used by matplotlib?

相关标签:
2条回答
  • 2020-12-02 14:30

    Use the get_backend() function to obtain a string denoting which backend is in use:

    >>> import matplotlib
    >>> matplotlib.get_backend()
    'TkAgg'
    
    0 讨论(0)
  • 2020-12-02 14:41

    Another way to determine the current backend is to read rcParams dictionary:

    >>> import matplotlib
    >>> print (matplotlib.rcParams['backend']) 
    MacOSX
    >>> matplotlib.use('agg')
    >>> print (matplotlib.rcParams['backend']) 
    agg
    
    0 讨论(0)
提交回复
热议问题