Set scale for an axis and constrain limits to valid range. Parameters ---------- axis : Axis The axis to set the scale on. value : str The scale name. **kwargs Forwarded to scale constructor.
(self, axis, value, **kwargs)
| 1130 | |
| 1131 | # Custom scale setters that handle limit validation for non-linear scales |
| 1132 | def _set_axis_scale(self, axis, value, **kwargs): |
| 1133 | """ |
| 1134 | Set scale for an axis and constrain limits to valid range. |
| 1135 | |
| 1136 | Parameters |
| 1137 | ---------- |
| 1138 | axis : Axis |
| 1139 | The axis to set the scale on. |
| 1140 | value : str |
| 1141 | The scale name. |
| 1142 | **kwargs |
| 1143 | Forwarded to scale constructor. |
| 1144 | """ |
| 1145 | # For non-linear scales on the z-axis, switch from the [0, 1] + |
| 1146 | # margin=0 representation to the same xymargin + margin=0.05 |
| 1147 | # representation that x/y use. Both produce identical linear limits, |
| 1148 | # but only the xymargin form has valid positive lower bounds for log |
| 1149 | # etc. This must happen before _set_axes_scale because that triggers |
| 1150 | # autoscale_view internally. |
| 1151 | if (axis is self.zaxis and value != 'linear' |
| 1152 | and np.array_equal(self.zz_dataLim.get_points(), [[0, 0], [1, 1]])): |
| 1153 | xymargin = 0.05 * 10/11 |
| 1154 | self.zz_dataLim = Bbox([[xymargin, xymargin], |
| 1155 | [1 - xymargin, 1 - xymargin]]) |
| 1156 | self._zmargin = self._xmargin |
| 1157 | axis._set_axes_scale(value, **kwargs) |
| 1158 | |
| 1159 | def set_xscale(self, value, **kwargs): |
| 1160 | """ |
no test coverage detected