Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3c6a2f0

Browse files
committed
generate list of path effects in RcParams object
1 parent593412d commit3c6a2f0

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

‎lib/matplotlib/__init__.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@
163163
frommatplotlib._apiimportMatplotlibDeprecationWarning
164164
frommatplotlib.rcsetupimportvalidate_backend,cycler
165165

166-
167166
_log=logging.getLogger(__name__)
168167

169168
__bibtex__=r"""@Article{Hunter:2007,
@@ -809,6 +808,21 @@ def copy(self):
809808
rccopy._set(k,self._get(k))
810809
returnrccopy
811810

811+
def_load_path_effects(self):
812+
"""defers loading of patheffects to avoid circular imports"""
813+
importmatplotlib.patheffectsaspath_effects
814+
815+
path_effects_list=self._get('path.effects').copy()
816+
print("before_loop: ",path_effects_list)
817+
fork,vinself.find_all('path.effects.').items():
818+
ifvisNone:
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+
returnpath_effects_list
825+
812826

813827
defrc_params(fail_on_error=False):
814828
"""Construct a `RcParams` instance from the default Matplotlib rc file."""

‎lib/matplotlib/artist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def __init__(self):
209209
self._gid=None
210210
self._snap=None
211211
self._sketch=mpl.rcParams['path.sketch']
212-
self._path_effects=[]
212+
self._path_effects=mpl.rcParams._load_path_effects()
213213
self._sticky_edges=_XYPair([], [])
214214
self._in_layout=True
215215

‎lib/matplotlib/patheffects.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@
55
.. seealso::
66
:ref:`patheffects_guide`
77
"""
8-
importsys
98

10-
importmatplotlibasmpl
119
frommatplotlib.backend_basesimportRendererBase
12-
importmatplotlib.cbookascbook
1310
frommatplotlibimportcolorsasmcolors
1411
frommatplotlibimportpatchesasmpatches
1512
frommatplotlibimporttransformsasmtransforms
@@ -93,13 +90,7 @@ def __init__(self, path_effects, renderer):
9390
renderer : `~matplotlib.backend_bases.RendererBase` subclass
9491
9592
"""
96-
compound_path_effects=mpl.rcParams['path.effects']
97-
fork,vinmpl.rcParams.find_all('path.effects.*').copy().items():
98-
ifpath_effect_name:=k.lstrip('path.effects')andvisnotNone:
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
10394
self._renderer=renderer
10495

10596
defcopy_with_path_effect(self,path_effects):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp