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

Fixed bug disabling axis labels with labelled option #2643

Merged
merged 1 commit into from
May 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,8 @@ def _update_plot(self, key, plot, element=None):
for axis, dim in zip(['x', 'y'], dimensions)}
xlabel, ylabel, zlabel = self._get_axis_labels(dimensions)
if self.invert_axes: xlabel, ylabel = ylabel, xlabel
props['x']['axis_label'] = xlabel
props['y']['axis_label'] = ylabel
props['x']['axis_label'] = xlabel if 'x' in self.labelled else ''
props['y']['axis_label'] = ylabel if 'y' in self.labelled else ''
recursive_model_update(plot.xaxis[0], props.get('x', {}))
recursive_model_update(plot.yaxis[0], props.get('y', {}))

Expand Down
20 changes: 19 additions & 1 deletion tests/plotting/bokeh/testelementplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_empty_element_visibility(self):
curve = Curve([])
plot = bokeh_renderer.get_plot(curve)
self.assertTrue(plot.handles['glyph_renderer'].visible)

def test_element_no_xaxis(self):
curve = Curve(range(10)).opts(plot=dict(xaxis=None))
plot = bokeh_renderer.get_plot(curve).state
Expand All @@ -48,6 +48,24 @@ def test_element_yrotation(self):
plot = bokeh_renderer.get_plot(curve).state
self.assertEqual(plot.yaxis[0].major_label_orientation, np.pi/2)

def test_element_labelled_x_disabled(self):
curve = Curve(range(10)).options(labelled=['y'])
plot = bokeh_renderer.get_plot(curve).state
self.assertEqual(plot.xaxis[0].axis_label, '')
self.assertEqual(plot.yaxis[0].axis_label, 'y')

def test_element_labelled_y_disabled(self):
curve = Curve(range(10)).options(labelled=['x'])
plot = bokeh_renderer.get_plot(curve).state
self.assertEqual(plot.xaxis[0].axis_label, 'x')
self.assertEqual(plot.yaxis[0].axis_label, '')

def test_element_labelled_both_disabled(self):
curve = Curve(range(10)).options(labelled=[])
plot = bokeh_renderer.get_plot(curve).state
self.assertEqual(plot.xaxis[0].axis_label, '')
self.assertEqual(plot.yaxis[0].axis_label, '')

def test_static_source_optimization(self):
global data
data = np.ones((5, 5))
Expand Down