Skip to content
Permalink
Browse files

Ensure axis are inverted after shared axis ranges are combined (#3083)

# Conflicts:
#	holoviews/plotting/bokeh/element.py
  • Loading branch information...
philippjfr authored and Philipp Rudiger committed Oct 17, 2018
1 parent 562e0ab commit bbfb4de11ce1bb46d4f5dc810b83ece7e025b1fd
@@ -207,16 +207,9 @@ def range(cls, dataset, dimension):
dmin, dmax = np.NaN, np.NaN
if dask and isinstance(dmin, dask.array.Array):
dmin, dmax = dask.array.compute(dmin, dmax)
dmin = dmin if np.isscalar(dmin) else dmin.item()
dmax = dmax if np.isscalar(dmax) else dmax.item()
=======

da = dask_array_module()
if da and isinstance(dmin, da.Array):
dmin, dmax = da.compute(dmin, dmax)
dmin = dmin if np.isscalar(dmin) or isinstance(dmin, util.datetime_types) else dmin.item()
dmax = dmax if np.isscalar(dmax) or isinstance(dmax, util.datetime_types) else dmax.item()
>>>>>>> a65ef977b... Ensure QuadMesh with xarray handles datetime range (#3081)

return dmin, dmax


@@ -540,11 +540,11 @@ 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 log and (low is None or low <= 0):
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, "
"please supply explicit lower-bound to override default of %.3f." % low)
@@ -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 bbfb4de

Please sign in to comment.
You can’t perform that action at this time.