Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added labelled plot option for bokeh plots #863

merged 1 commit into from Sep 16, 2016
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+9 −7
Diff settings


Just for now

@@ -82,6 +82,9 @@ class ElementPlot(BokehPlot, GenericElementPlot):
invert_yaxis = param.Boolean(default=False, doc="""
Whether to invert the plot y-axis.""")

labelled = param.List(default=['x', 'y'], doc="""
Whether to plot the 'x' and 'y' labels.""")

lod = param.Dict(default={'factor': 10, 'interval': 300,
'threshold': 2000, 'timeout': 500}, doc="""
Bokeh plots offer "Level of Detail" (LOD) capability to
@@ -161,8 +164,7 @@ class ElementPlot(BokehPlot, GenericElementPlot):
# instance attribute.
_update_handles = ['source', 'glyph']

def __init__(self, element, plot=None, show_labels=['x', 'y'], **params):
self.show_labels = show_labels
def __init__(self, element, plot=None, **params):
self.current_ranges = None
super(ElementPlot, self).__init__(element, **params)
self.handles = {} if plot is None else self.handles['plot']
@@ -285,8 +287,8 @@ def _init_plot(self, key, element, plots, ranges=None):
xlabel, ylabel, _ = labels
x_axis_type, y_axis_type = axis_types
properties = dict(plot_ranges)
properties['x_axis_label'] = xlabel if 'x' in self.show_labels else ' '
properties['y_axis_label'] = ylabel if 'y' in self.show_labels else ' '
properties['x_axis_label'] = xlabel if 'x' in self.labelled else ' '
properties['y_axis_label'] = ylabel if 'y' in self.labelled else ' '

if self.show_title:
title = self._format_title(key, separator=' ')
@@ -389,11 +389,11 @@ def _create_subplots(self, layout, positions, layout_dimensions, ranges, num=0):
yaxis = 'right-bare' if 'bare' in plot_type.yaxis else 'right'
side_opts = dict(height=main_plot.height, yaxis=yaxis,
width=plot_type.width, invert_axes=True,
show_labels=['y'], xticks=1, xaxis=main_plot.xaxis)
labelled=['y'], xticks=1, xaxis=main_plot.xaxis)
xaxis = 'top-bare' if 'bare' in plot_type.xaxis else 'top'
side_opts = dict(width=main_plot.width, xaxis=xaxis,
height=plot_type.height, show_labels=['x'],
height=plot_type.height, labelled=['x'],
yticks=1, yaxis=main_plot.yaxis)

# Override the plotopts as required
@@ -19,7 +19,7 @@ class TablePlot(BokehPlot, GenericElementPlot):

_update_handles = ['source', 'glyph']

def __init__(self, element, plot=None, show_labels=['x', 'y'], **params):
def __init__(self, element, plot=None, **params):
super(TablePlot, self).__init__(element, **params)
self.handles = {} if plot is None else self.handles['plot']
element_ids = self.hmap.traverse(lambda x: id(x), [Dataset, ItemTable])
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.