Commit 4991080b authored by Philipp Gast's avatar Philipp Gast
Browse files

new suggestion on MyFig.update().

MyAxes.update() allows to write the MyFig.update() shorter and clearer. I vote to make use of that.
parent c1866284
......@@ -135,24 +135,16 @@ class MyFig(Figure):
elif keyword in self._attributesToUpdateKeys:
# update value
setattr(self, keyword, kwargs[keyword])
# For each axes update the keywords
for ax in self.get_axes():
axkwargs = kwargs.copy() # make a copy of kwargs for this axes
# Check if a key of kwargs has an alias for this axes
for axk in axkwargs.keys():
if axk in self.aliases.keys():
alax, alkey = self.aliases[axk]
# If an alias is found then update axkwargs
if ax == alax:
axkwargs.update({alkey: kwargs[axk]})
# When eventual alias are added then update
ax.update(**axkwargs)
elif keyword in self.aliases.keys():
# if it is a alias update only the coresponding axes
alax, alkey = self.aliases[keyword]
alax.update(**{alkey : kwargs[keyword]})
else :
# otherwise update all axes with keyword (not matching keywords are ignored by axes)
for ax in self.get_axes():
ax.update(**{keyword : kwargs[keyword]})
return(True)
# DECLARE ALIASES -------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment