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

Try/except get_extents without dimension and add kwargs to all get_extents #5872

Merged
merged 3 commits into from
Sep 6, 2023
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
10 changes: 6 additions & 4 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,11 @@ def _axis_props(self, plots, subplots, element, ranges, pos, *, dim=None,
axis_label = str(dim)
specs = ((dim.name, dim.label, dim.unit),)
else:
if isinstance(self, OverlayPlot):
try:
l, b, r, t = self.get_extents(range_el, ranges, dimension=dim)
else:
except TypeError:
# Backward compatibility for e.g. GeoViews=<1.10.1 since dimension
# is a newly added keyword argument in HoloViews 1.17
l, b, r, t = self.get_extents(range_el, ranges)
if self.invert_axes:
l, b, r, t = b, l, t, r
Expand Down Expand Up @@ -983,9 +985,9 @@ def _update_main_ranges(self, element, x_range, y_range, ranges):
range_dim = None
try:
l, b, r, t = self.get_extents(element, ranges, dimension=range_dim)
except Exception:
except TypeError:
# Backward compatibility for e.g. GeoViews=<1.10.1 since dimension
# is a newly added keyword argument
# is a newly added keyword argument in HoloViews 1.17
l, b, r, t = self.get_extents(element, ranges)
if self.invert_axes:
l, b, r, t = b, l, t, r
Expand Down
4 changes: 2 additions & 2 deletions holoviews/plotting/mpl/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def get_data(self, element, ranges, style):
pos_error = element.dimension_values(pos_idx)
return (xs, mean-neg_error, mean+pos_error), style, {}

def get_extents(self, element, ranges, range_type='combined'):
def get_extents(self, element, ranges, range_type='combined', **kwargs):
return ChartPlot.get_extents(self, element, ranges, range_type)


Expand Down Expand Up @@ -390,7 +390,7 @@ def _compute_ticks(self, element, edges, widths, lims):
labels = [dim.pprint_value(v) for v in xvals]
return [xvals, labels]

def get_extents(self, element, ranges, range_type='combined'):
def get_extents(self, element, ranges, range_type='combined', **kwargs):
ydim = element.get_dimension(1)
s0, s1 = ranges[ydim.name]['soft']
s0 = min(s0, 0) if isfinite(s0) else 0
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/mpl/heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def _get_ticks(ticks, ticker):
return ticks


def get_extents(self, view, ranges, range_type='combined'):
def get_extents(self, view, ranges, range_type='combined', **kwargs):
if range_type == 'hard':
return (np.nan,)*4
return (0, 0, np.pi*2, self.max_radius+self.radius_outer)
Expand Down
4 changes: 2 additions & 2 deletions holoviews/plotting/mpl/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class RasterBasePlot(ElementPlot):

_plot_methods = dict(single='imshow')

def get_extents(self, element, ranges, range_type='combined'):
def get_extents(self, element, ranges, range_type='combined', **kwargs):
extents = super().get_extents(element, ranges, range_type)
if self.situate_axes or range_type not in ('combined', 'data'):
return extents
Expand Down Expand Up @@ -294,7 +294,7 @@ def __init__(self, layout, keys=None, dimensions=None, create_axes=False, ranges
def _finalize_artist(self, key):
pass

def get_extents(self, view, ranges, range_type='combined'):
def get_extents(self, view, ranges, range_type='combined', **kwargs):
if range_type == 'hard':
return (np.nan,)*4
width, height, _, _, _, _ = self.border_extents
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/mpl/sankey.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SankeyPlot(GraphPlot):

style_opts = GraphPlot.style_opts + ['label_text_font_size']

def get_extents(self, element, ranges, range_type='combined'):
def get_extents(self, element, ranges, range_type='combined', **kwargs):
"""
A Chord plot is always drawn on a unit circle.
"""
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ def _get_range_extents(self, element, ranges, range_type, xdim, ydim, zdim):

return (x0, y0, x1, y1)

def get_extents(self, element, ranges, range_type='combined', dimension=None, xdim=None, ydim=None, zdim=None):
def get_extents(self, element, ranges, range_type='combined', dimension=None, xdim=None, ydim=None, zdim=None, **kwargs):
"""
Gets the extents for the axes from the current Element. The globally
computed ranges can optionally override the extents.
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/plotly/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def _get_axis_dims(self, element):
xdims = element.kdims[0]
return (xdims, element.vdims[0])

def get_extents(self, element, ranges, range_type='combined'):
def get_extents(self, element, ranges, range_type='combined', **kwargs):
x0, y0, x1, y1 = BarsMixin.get_extents(self, element, ranges, range_type)
if range_type not in ('data', 'combined'):
return x0, y0, x1, y1
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/plotly/tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def graph_options(self, element, ranges, style, **kwargs):

return opts

def get_extents(self, element, ranges, range_type='combined'):
def get_extents(self, element, ranges, range_type='combined', **kwargs):
extents = super().get_extents(element, ranges, range_type)
if (not self.overlaid and all(e is None or not np.isfinite(e) for e in extents)
and range_type in ('combined', 'data')):
Expand Down