in python-package/lets_plot/plot/subplots.py [0:0]
def __add__(self, other):
"""
"""
if isinstance(other, DummySpec):
# nothing
return self
elif isinstance(other, FeatureSpecArray):
supplots = SupPlotsSpec.duplicate(self)
for spec in other.elements():
supplots = supplots.__add__(spec)
return supplots
elif isinstance(other, FeatureSpec) and other.kind in ["ggsize", "theme", "ggtitle", "caption", "ggtoolbar"]:
supplots = SupPlotsSpec.duplicate(self)
# ToDo: duplication!
if other.kind == 'theme':
new_theme_options = {k: v for k, v in other.props().items() if v is not None}
if 'name' in new_theme_options:
# keep the previously specified flavor
if supplots.props().get('theme', {}).get('flavor', None) is not None:
new_theme_options.update({'flavor': supplots.props()['theme']['flavor']})
# pre-configured theme overrides existing theme altogether.
supplots.props()['theme'] = new_theme_options
else:
# merge themes
old_theme_options = supplots.props().get('theme', {})
supplots.props()['theme'] = _theme_dicts_merge(old_theme_options, new_theme_options)
return supplots
# add feature to properties
supplots.props()[other.kind] = other
return supplots
return super().__add__(other)