File tree 3 files changed +17
-12
lines changed
Filter options
3 files changed +17
-12
lines changed
Original file line number Diff line number Diff line change 163
163
from matplotlib ._api import MatplotlibDeprecationWarning
164
164
from matplotlib .rcsetup import validate_backend , cycler
165
165
166
-
167
166
_log = logging .getLogger (__name__ )
168
167
169
168
__bibtex__ = r"""@Article{Hunter:2007,
@@ -809,6 +808,21 @@ def copy(self):
809
808
rccopy ._set (k , self ._get (k ))
810
809
return rccopy
811
810
811
+ def _load_path_effects (self ):
812
+ """defers loading of patheffects to avoid circular imports"""
813
+ import matplotlib .patheffects as path_effects
814
+
815
+ path_effects_list = self ._get ('path.effects' ).copy ()
816
+ print ("before_loop: " , path_effects_list )
817
+ for k , v in self .find_all ('path.effects.' ).items ():
818
+ if v is None :
819
+ continue
820
+ path_effect_name = k .split ('.' )[- 1 ]
821
+ path_effect_function = getattr (path_effects , path_effect_name )
822
+ path_effects_list .append (path_effect_function (** v ))
823
+ print ("after_loop: " , path_effects_list )
824
+ return path_effects_list
825
+
812
826
813
827
def rc_params (fail_on_error = False ):
814
828
"""Construct a `RcParams` instance from the default Matplotlib rc file."""
Original file line number Diff line number Diff line change @@ -209,7 +209,7 @@ def __init__(self):
209
209
self ._gid = None
210
210
self ._snap = None
211
211
self ._sketch = mpl .rcParams ['path.sketch' ]
212
- self ._path_effects = []
212
+ self ._path_effects = mpl . rcParams . _load_path_effects ()
213
213
self ._sticky_edges = _XYPair ([], [])
214
214
self ._in_layout = True
215
215
Original file line number Diff line number Diff line change 5
5
.. seealso::
6
6
:ref:`patheffects_guide`
7
7
"""
8
- import sys
9
8
10
- import matplotlib as mpl
11
9
from matplotlib .backend_bases import RendererBase
12
- import matplotlib .cbook as cbook
13
10
from matplotlib import colors as mcolors
14
11
from matplotlib import patches as mpatches
15
12
from matplotlib import transforms as mtransforms
@@ -93,13 +90,7 @@ def __init__(self, path_effects, renderer):
93
90
renderer : `~matplotlib.backend_bases.RendererBase` subclass
94
91
95
92
"""
96
- compound_path_effects = mpl .rcParams ['path.effects' ]
97
- for k , v in mpl .rcParams .find_all ('path.effects.*' ).copy ().items ():
98
- if path_effect_name := k .lstrip ('path.effects' ) and v is not None :
99
- path_effect_function = sys .modules [__name__ ].__dict__ [path_effect_name ]
100
- compound_path_effects .append (path_effect_function (** v ))
101
- compound_path_effects .append (path_effects )
102
- self ._path_effects = cbook .flatten (compound_path_effects )
93
+ self ._path_effects = path_effects
103
94
self ._renderer = renderer
104
95
105
96
def copy_with_path_effect (self , path_effects ):
You can’t perform that action at this time.
0 commit comments