Estimate the scale of the 3D data for use in depth shading Parameters ---------- X, Y, Z : masked arrays The data to estimate the scale of.
(X, Y, Z)
| 916 | |
| 917 | |
| 918 | def _get_data_scale(X, Y, Z): |
| 919 | """ |
| 920 | Estimate the scale of the 3D data for use in depth shading |
| 921 | |
| 922 | Parameters |
| 923 | ---------- |
| 924 | X, Y, Z : masked arrays |
| 925 | The data to estimate the scale of. |
| 926 | """ |
| 927 | # Account for empty datasets. Assume that X Y and Z have the same number |
| 928 | # of elements. |
| 929 | if not np.ma.count(X): |
| 930 | return 0 |
| 931 | |
| 932 | # Estimate the scale using the RSS of the ranges of the dimensions |
| 933 | # Note that we don't use np.ma.ptp() because we otherwise get a build |
| 934 | # warning about handing empty arrays. |
| 935 | ptp_x = X.max() - X.min() |
| 936 | ptp_y = Y.max() - Y.min() |
| 937 | ptp_z = Z.max() - Z.min() |
| 938 | return np.sqrt(ptp_x ** 2 + ptp_y ** 2 + ptp_z ** 2) |
| 939 | |
| 940 | |
| 941 | class Path3DCollection(PathCollection): |
no test coverage detected
searching dependent graphs…