Skip to content

Commit

Permalink
Ensure axis are inverted after shared axis ranges are combined (#3083)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored and jlstevens committed Oct 17, 2018
1 parent 25505a4 commit 90e8e69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,10 @@ def _update_range(self, axis_range, low, high, factors, invert, shared, log, str
offset = abs(low*0.1 if low else 0.5)
low -= offset
high += offset
if invert: low, high = high, low
if shared:
shared = (axis_range.start, axis_range.end)
low, high = util.max_range([(low, high), shared])
if invert: low, high = high, low
if not isinstance(low, util.datetime_types) and log and (low is None or low <= 0):
low = 0.01 if high < 0.01 else 10**(np.log10(high)-2)
self.warning("Logarithmic axis range encountered value less than or equal to zero, "
Expand Down
8 changes: 8 additions & 0 deletions holoviews/tests/plotting/bokeh/testlayoutplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,11 @@ def test_layout_disable_toolbar(self):
plot = bokeh_renderer.get_plot(layout)
self.assertIsInstance(plot.state, Column)
self.assertEqual(len(plot.state.children), 1)

def test_layout_shared_inverted_yaxis(self):
layout = (Curve([]) + Curve([])).options('Curve', invert_yaxis=True)
plot = bokeh_renderer.get_plot(layout)
subplot = list(plot.subplots.values())[0].subplots['main']
self.assertEqual(subplot.handles['y_range'].start, 1)
self.assertEqual(subplot.handles['y_range'].end, 0)

0 comments on commit 90e8e69

Please sign in to comment.