File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -770,13 +770,24 @@ def get_edgecolor(self):
770
770
def _get_data_scale (X , Y , Z ):
771
771
"""
772
772
Estimate the scale of the 3D data for use in depth shading
773
+
774
+ Parameters
775
+ ----------
776
+ X, Y, Z : masked arrays
777
+ The data to estimate the scale of.
773
778
"""
774
- # Account for empty datasets. Assume that X Y and Z have equal lengths
775
- if len (X ) == 0 :
779
+ # Account for empty datasets. Assume that X Y and Z have the same number
780
+ # of elements.
781
+ if not np .ma .count (X ):
776
782
return 0
777
783
778
784
# Estimate the scale using the RSS of the ranges of the dimensions
779
- return np .sqrt (np .ma .ptp (X ) ** 2 + np .ma .ptp (Y ) ** 2 + np .ma .ptp (Z ) ** 2 )
785
+ # Note that we don't use np.ma.ptp() because we otherwise get a build
786
+ # warning about handing empty arrays.
787
+ ptp_x = X .max () - X .min ()
788
+ ptp_y = Y .max () - Y .min ()
789
+ ptp_z = Z .max () - Z .min ()
790
+ return np .sqrt (ptp_x ** 2 + ptp_y ** 2 + ptp_z ** 2 )
780
791
781
792
782
793
class Path3DCollection (PathCollection ):
You can’t perform that action at this time.
0 commit comments