Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Coder avec une
Intelligence Artificielle
Voir le programme détaillé
Module « matplotlib »

Fonction rc_context - module matplotlib

Signature de la fonction rc_context

def rc_context(rc=None, fname=None) 

Description

help(matplotlib.rc_context)

Return a context manager for temporarily changing rcParams.

The :rc:`backend` will not be reset by the context manager.

rcParams changed both through the context manager invocation and
in the body of the context will be reset on context exit.

Parameters
----------
rc : dict
    The rcParams to temporarily set.
fname : str or path-like
    A file with Matplotlib rc settings. If both *fname* and *rc* are given,
    settings from *rc* take precedence.

See Also
--------
:ref:`customizing-with-matplotlibrc-files`

Examples
--------
Passing explicit values via a dict::

    with mpl.rc_context({'interactive': False}):
        fig, ax = plt.subplots()
        ax.plot(range(3), range(3))
        fig.savefig('example.png')
        plt.close(fig)

Loading settings from a file::

     with mpl.rc_context(fname='print.rc'):
         plt.plot(x, y)  # uses 'print.rc'

Setting in the context body::

    with mpl.rc_context():
        # will be reset
        mpl.rcParams['lines.linewidth'] = 5
        plt.plot(x, y)



Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé