Skip to content

Commit

Permalink
Merge 792844c into ae8619a
Browse files Browse the repository at this point in the history
  • Loading branch information
jbednar committed Nov 6, 2019
2 parents ae8619a + 792844c commit cf62016
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 14 deletions.
11 changes: 2 additions & 9 deletions holoviews/element/raster.py
Expand Up @@ -582,15 +582,8 @@ def range(self, dim, data_range=True, dimension_range=True):
idx = self.get_dimension_index(dim)
dimension = self.get_dimension(dim)
if idx in [0, 1] and data_range and dimension.range == (None, None):
if self.interface.datatype == 'image':
l, b, r, t = self.bounds.lbrt()
return (b, t) if idx else (l, r)
low, high = super(Image, self).range(dim, data_range)
density = self.ydensity if idx else self.xdensity
halfd = (1./density)/2.
if isinstance(low, util.datetime_types):
halfd = np.timedelta64(int(round(halfd)), self._time_unit)
return (low-halfd, high+halfd)
l, b, r, t = self.bounds.lbrt()
return (b, t) if idx else (l, r)
else:
return super(Image, self).range(dim, data_range, dimension_range)

Expand Down
6 changes: 5 additions & 1 deletion holoviews/plotting/bokeh/element.py
Expand Up @@ -26,7 +26,7 @@
from ...core.options import abbreviated_exception, SkipRendering
from ...core import util
from ...element import Graph, VectorField, Path, Contours, Tiles
from ...streams import Buffer, PlotSize
from ...streams import Stream, Buffer, PlotSize
from ...util.transform import dim
from ..plot import GenericElementPlot, GenericOverlayPlot
from ..util import dynamic_update, process_cmap, color_intervals, dim_range_key
Expand Down Expand Up @@ -1291,6 +1291,10 @@ def initialize_plot(self, ranges=None, plot=None, plots=None, source=None):

self.drawn = True

trigger = self._trigger
self._trigger = []
Stream.trigger(trigger)

return plot


Expand Down
5 changes: 5 additions & 0 deletions holoviews/plotting/mpl/element.py
Expand Up @@ -17,6 +17,7 @@
CompositeOverlay, Element3D, Element)
from ...core.options import abbreviated_exception
from ...element import Graph, Path
from ...streams import Stream
from ...util.transform import dim
from ..plot import GenericElementPlot, GenericOverlayPlot
from ..util import dynamic_update, process_cmap, color_intervals, dim_range_key
Expand Down Expand Up @@ -512,6 +513,10 @@ def initialize_plot(self, ranges=None):
handles = self.init_artists(ax, plot_data, plot_kwargs)
self.handles.update(handles)

trigger = self._trigger
self._trigger = []
Stream.trigger(trigger)

return self._finalize_axis(self.keys[-1], element=element, ranges=ranges,
**axis_kwargs)

Expand Down
27 changes: 23 additions & 4 deletions holoviews/plotting/plot.py
Expand Up @@ -28,7 +28,7 @@
from ..core.spaces import HoloMap, DynamicMap
from ..core.util import stream_parameters, isfinite
from ..element import Table, Graph, Contours
from ..streams import Stream
from ..streams import Stream, RangeXY, RangeX, RangeY
from ..util.transform import dim
from .util import (get_dynamic_mode, initialize_unbounded, dim_axis_label,
attach_streams, traverse_setter, get_nested_streams,
Expand Down Expand Up @@ -63,6 +63,7 @@ def __init__(self, renderer=None, root=None, **params):
self._root = None
self._pane = None
self._triggering = []
self._trigger = []
self.set_root(root)


Expand Down Expand Up @@ -1153,9 +1154,27 @@ def _get_range_extents(self, element, ranges, range_type, xdim, ydim, zdim):

if not self.overlaid and not self.batched:
xspan, yspan, zspan = (v/2. for v in get_axis_padding(self.default_span))
x0, x1 = get_minimum_span(x0, x1, xspan)
y0, y1 = get_minimum_span(y0, y1, yspan)
z0, z1 = get_minimum_span(z0, z1, zspan)
mx0, mx1 = get_minimum_span(x0, x1, xspan)

# If auto-padding is enabled ensure RangeXY dependent plots
# are recomputed before initial render
if x0 != mx0 or x1 != mx1:
for stream in self.streams:
if isinstance(stream, (RangeX, RangeXY)):
stream.update(x_range=(mx0, mx1))
if stream not in self._trigger:
self._trigger.append(stream)
x0, x1 = mx0, mx1
my0, my1 = get_minimum_span(y0, y1, yspan)
if y0 != my0 or y1 != my1:
for stream in self.streams:
if isinstance(stream, (RangeY, RangeXY)):
stream.update(y_range=(my0, my1))
if stream not in self._trigger:
self._trigger.append(stream)
y0, y1 = my0, my1

mz0, mz1 = get_minimum_span(z0, z1, zspan)
xpad, ypad, zpad = self.get_padding((x0, y0, z0, x1, y1, z1))

if range_type == 'soft':
Expand Down
6 changes: 6 additions & 0 deletions holoviews/plotting/plotly/element.py
Expand Up @@ -8,6 +8,7 @@
from ...core import util
from ...core.element import Element
from ...core.spaces import DynamicMap
from ...streams import Stream
from ...util.transform import dim
from ..plot import GenericElementPlot, GenericOverlayPlot
from ..util import dim_range_key, dynamic_update
Expand Down Expand Up @@ -116,6 +117,11 @@ def initialize_plot(self, ranges=None):
# Get element key and ranges for frame
fig = self.generate_plot(self.keys[-1], ranges)
self.drawn = True

trigger = self._trigger
self._trigger = []
Stream.trigger(trigger)

return fig


Expand Down

0 comments on commit cf62016

Please sign in to comment.