Skip to content

Commit

Permalink
Add options inheritance on OverlayPlot
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Jan 13, 2017
1 parent 0367391 commit 567a9b4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions holoviews/plotting/bokeh/element.py
Expand Up @@ -1017,6 +1017,11 @@ class OverlayPlot(GenericOverlayPlot, LegendPlot):

_update_handles = ['source']

_inherited_options = ['width', 'height', 'xaxis', 'yaxis', 'labelled',
'bgcolor', 'fontsize', 'invert_axes', 'show_frame',
'show_grid', 'show_legend', 'logx', 'logy', 'xticks',
'yticks', 'xrotation', 'yrotation']

def _process_legend(self):
plot = self.handles['plot']
if not self.show_legend or len(plot.legend) == 0:
Expand Down
6 changes: 6 additions & 0 deletions holoviews/plotting/mpl/element.py
Expand Up @@ -725,6 +725,12 @@ class OverlayPlot(LegendPlot, GenericOverlayPlot):

_passed_handles = ['fig', 'axis']

_inherited_options = ['aspect', 'fig_size', 'xaxis', 'yaxis', 'zaxis',
'labelled', 'bgcolor', 'fontsize', 'invert_axes',
'show_frame', 'show_grid', 'logx', 'logy', 'logz',
'xticks', 'yticks', 'zticks', 'xrotation', 'yrotation'
'zrotation']

def __init__(self, overlay, ranges=None, **params):
if 'projection' not in params:
params['projection'] = self._get_projection(overlay)
Expand Down
4 changes: 4 additions & 0 deletions holoviews/plotting/plot.py
Expand Up @@ -547,6 +547,8 @@ class GenericElementPlot(DimensionedPlot):
# plot and a 'batched' method to draw multiple Elements at once
_plot_methods = {}

_inherited_options = []

def __init__(self, element, keys=None, ranges=None, dimensions=None,
batched=False, overlaid=0, cyclic_index=0, zorder=0, style=None,
overlay_dims={}, **params):
Expand All @@ -573,6 +575,8 @@ def __init__(self, element, keys=None, ranges=None, dimensions=None,

self.style = self.lookup_options(plot_element, 'style') if style is None else style
plot_opts = self.lookup_options(plot_element, 'plot').options
inherited = self._traverse_options(plot_element, 'plot', self._inherited_options)
plot_opts.update(**{k: v[0] for k, v in inherited.items()})

dynamic = False if not isinstance(element, DynamicMap) or element.sampled else element.mode
super(GenericElementPlot, self).__init__(keys=keys, dimensions=dimensions,
Expand Down

0 comments on commit 567a9b4

Please sign in to comment.