Commit 647248b8 authored by Yori 'AGy' Fournier's avatar Yori 'AGy' Fournier
Browse files

now correction is shorter and cleaner

inlined looping, and make use of matplotlib.axes.update function
parent 3b50ada9
......@@ -66,7 +66,7 @@ class MyAxes(Axes):
Axes.__init__(self, fig, rect, **kwargs)
# set a default name. Should be individualized by instance
self.name='default'
self.name = 'default'
# COMPUTE RECT -------------------------------------------------------
......@@ -112,16 +112,10 @@ class MyAxes(Axes):
def update(self, *args, **kwargs):
# Because matplotlib.axes.update expect kwargs and not **kwargs ... (stupid!!)
if len(args): # catch matplotlib kwargs
for key in args[0].keys(): # check if some of them are keywords
if key in self.keywords.keys():
self.keywords[key] = args[0][key] # if found update
del args[0][key] # and suppress
Axes.update(self, args[0]) # update matplotlib.Axes
if args: # catch matplotlib kwargs
kwargs = args[0]
kw_for_axes = {key: value for (key, value) in args[0].items() if key not in self.keywords}
Axes.update(self, kw_for_axes) # update matplotlib.Axes
for key in kwargs.keys():
if key in self.keywords.keys():
self.keywords[key] = kwargs[key]
# myplotlib update
self.keywords.update({key: value for (key, value) in kwargs.items() if key in self.keywords})
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