diff --git a/lib/matplotlib/artist.py b/lib/matplotlib/artist.py index e6f323d4a1ce..1c40efbb4aab 100644 --- a/lib/matplotlib/artist.py +++ b/lib/matplotlib/artist.py @@ -1391,6 +1391,61 @@ def set_mouseover(self, mouseover): mouseover = property(get_mouseover, set_mouseover) # backcompat. +def set_datalim_x(self, data): + """ + Set the x-axis data limits for this 3D plot. + + Parameters + ---------- + data : array-like + The array containing data points for the x-axis. + """ + self._datalim_x = (min(data), max(data)) + + ax = self.axes + if ax: + ax.dataLim.update_from_data_x(self._datalim_x) + +datalim_x = property(lambda self: self._datalim_x, set_datalim_x) + + +def set_datalim_y(self, data): + """ + Set the y-axis data limits for this 3D plot. + + Parameters + ---------- + data : array-like + The array containing data points for the y-axis. + """ + self._datalim_y = (min(data), max(data)) + + ax = self.axes + if ax: + ax.dataLim.update_from_data_y(self._datalim_y) + +datalim_y = property(lambda self: self._datalim_y, set_datalim_y) + + +def set_datalim_z(self, data): + """ + Set the z-axis data limits for this 3D plot. + + Parameters + ---------- + data : array-like + The array containing data points for the z-axis. + """ + self._datalim_z = (min(data), max(data)) + + ax = self.axes + if ax: + ax.dataLim.update_from_data_z(self._datalim_z) + +datalim_z = property(lambda self: self._datalim_z, set_datalim_z) + + + def _get_tightbbox_for_layout_only(obj, *args, **kwargs): """ diff --git a/lib/matplotlib/cbook.py b/lib/matplotlib/cbook.py index 71ff5a941601..335e94f446fc 100644 --- a/lib/matplotlib/cbook.py +++ b/lib/matplotlib/cbook.py @@ -2341,6 +2341,11 @@ def _is_tensorflow_array(x): def _unpack_to_numpy(x): """Internal helper to extract data from e.g. pandas and xarray objects.""" + if isinstance(x, ak.Array): + # Normalize akward irregular arrays to numpy array + xtmp = ak.to_numpy(ak.flatten(x)) + print("Entrou") + return xtmp if isinstance(x, np.ndarray): # If numpy, return directly return x