File tree Expand file tree Collapse file tree 1 file changed +0
-23
lines changed Expand file tree Collapse file tree 1 file changed +0
-23
lines changed Original file line number Diff line number Diff line change 93
93
}
94
94
95
95
96
- def _safe_pyplot_import ():
97
- """
98
- Import and return ``pyplot``, correctly setting the backend if one is
99
- already forced.
100
- """
101
- try :
102
- import matplotlib .pyplot as plt
103
- except ImportError : # Likely due to a framework mismatch.
104
- current_framework = cbook ._get_running_interactive_framework ()
105
- if current_framework is None :
106
- raise # No, something else went wrong, likely with the install...
107
-
108
- from matplotlib .backends import backend_registry
109
- backend = backend_registry .backend_for_gui_framework (current_framework )
110
- if backend is None :
111
- raise RuntimeError ("No suitable backend for the current GUI framework "
112
- f"{ current_framework !r} " )
113
-
114
- rcParams ["backend" ] = mpl .rcParamsOrig ["backend" ] = backend
115
- import matplotlib .pyplot as plt # Now this should succeed.
116
- return plt
117
-
118
-
119
96
def register_backend (format , backend , description = None ):
120
97
"""
121
98
Register a backend for saving to a given file format.
You can’t perform that action at this time.
0 commit comments