diff --git a/holoviews/plotting/mpl/element.py b/holoviews/plotting/mpl/element.py index 695305bf02..4d8c86ee25 100644 --- a/holoviews/plotting/mpl/element.py +++ b/holoviews/plotting/mpl/element.py @@ -171,7 +171,7 @@ def _finalize_axis(self, key, element=None, title=None, dimensions=None, ranges= if self.logy: axis.set_yscale('log') - if not isinstance(self.projection, str) and self.projection == '3d': + if not (isinstance(self.projection, str) and self.projection == '3d'): self._set_axis_position(axis, 'x', self.xaxis) self._set_axis_position(axis, 'y', self.yaxis) @@ -324,7 +324,7 @@ def _set_axis_limits(self, axis, view, subplots, ranges): coords = [coord if isinstance(coord, np.datetime64) or np.isreal(coord) else np.NaN for coord in extents] coords = [date2num(util.dt64_to_dt(c)) if isinstance(c, np.datetime64) else c for c in coords] - if isinstance(self.projection, str) and self.projection == '3d' or len(extents) == 6: + if (isinstance(self.projection, str) and self.projection == '3d') or len(extents) == 6: l, b, zmin, r, t, zmax = coords if self.invert_zaxis or any(p.invert_zaxis for p in subplots): zmin, zmax = zmax, zmin diff --git a/holoviews/tests/plotting/matplotlib/test_elementplot.py b/holoviews/tests/plotting/matplotlib/test_elementplot.py index de06cbc2a9..8e9dce71e9 100644 --- a/holoviews/tests/plotting/matplotlib/test_elementplot.py +++ b/holoviews/tests/plotting/matplotlib/test_elementplot.py @@ -59,6 +59,14 @@ def test_element_font_scaling_fontsize_override_specific(self): self.assertEqual(ax.xaxis._major_tick_kw['labelsize'], 24) self.assertEqual(ax.yaxis._major_tick_kw['labelsize'], 20) + def test_element_no_xaxis_yaxis(self): + element = Curve(range(10)).options(xaxis=None, yaxis=None) + axes = mpl_renderer.get_plot(element).handles['axis'] + xaxis = axes.get_xaxis() + yaxis = axes.get_yaxis() + self.assertEqual(xaxis.get_visible(), False) + self.assertEqual(yaxis.get_visible(), False) + def test_element_xlabel(self): element = Curve(range(10)).options(xlabel='custom x-label') axes = mpl_renderer.get_plot(element).handles['axis']