Skip to content

Commit

Permalink
Ensure all clone methods correctly retain id (#2013)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored and jlstevens committed Oct 22, 2017
1 parent 73038d7 commit 093caa2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion holoviews/core/ndmapping.py
Expand Up @@ -763,7 +763,7 @@ def clone(self, data=None, shared_data=True, new_type=None, *args, **overrides):
settings = {k: v for k, v in settings.items()
if k in new_params}
settings = dict(settings, **overrides)
if 'id' not in settings:
if 'id' not in settings and new_type in [type(self), None]:
settings['id'] = self.id

if data is None and shared_data:
Expand Down
2 changes: 2 additions & 0 deletions holoviews/element/annotation.py
Expand Up @@ -66,6 +66,8 @@ def clone(self, *args, **overrides):
pos_args = getattr(self, '_' + type(self).__name__ + '__pos_params', [])
settings = {k: v for k, v in dict(self.get_param_values(), **overrides).items()
if k not in pos_args[:len(args)]}
if 'id' not in settings:
settings['id'] = self.id
return self.__class__(*args, **settings)


Expand Down
2 changes: 2 additions & 0 deletions holoviews/element/path.py
Expand Up @@ -200,6 +200,8 @@ def clone(self, *args, **overrides):
containing the specified args and kwargs.
"""
settings = dict(self.get_param_values(), **overrides)
if 'id' not in settings:
settings['id'] = self.id
if not args:
settings['plot_id'] = self._plot_id

Expand Down

0 comments on commit 093caa2

Please sign in to comment.