Apply axis scale transforms to 3D coordinates. Transforms data coordinates to transformed coordinates (applying log, symlog, etc.) for 3D projection. Preserves masked arrays.
(xs, ys, zs, axes)
| 132 | |
| 133 | |
| 134 | def _apply_scale_transforms(xs, ys, zs, axes): |
| 135 | """ |
| 136 | Apply axis scale transforms to 3D coordinates. |
| 137 | |
| 138 | Transforms data coordinates to transformed coordinates (applying log, |
| 139 | symlog, etc.) for 3D projection. Preserves masked arrays. |
| 140 | """ |
| 141 | def transform_coord(coord, axis): |
| 142 | coord = np.asanyarray(coord) |
| 143 | data = np.ma.getdata(coord).ravel() |
| 144 | return axis.get_transform().transform(data).reshape(coord.shape) |
| 145 | |
| 146 | xs_scaled = transform_coord(xs, axes.xaxis) |
| 147 | ys_scaled = transform_coord(ys, axes.yaxis) |
| 148 | zs_scaled = transform_coord(zs, axes.zaxis) |
| 149 | |
| 150 | # Preserve combined mask from any masked input |
| 151 | masks = [np.ma.getmask(a) for a in [xs, ys, zs]] |
| 152 | if any(m is not np.ma.nomask for m in masks): |
| 153 | combined = np.ma.mask_or(np.ma.mask_or(masks[0], masks[1]), masks[2]) |
| 154 | xs_scaled = np.ma.array(xs_scaled, mask=combined) |
| 155 | ys_scaled = np.ma.array(ys_scaled, mask=combined) |
| 156 | zs_scaled = np.ma.array(zs_scaled, mask=combined) |
| 157 | |
| 158 | return xs_scaled, ys_scaled, zs_scaled |
| 159 | |
| 160 | |
| 161 | def _proj_transform_vec(vec, M): |
no test coverage detected
searching dependent graphs…