|
31 | 31 | """ |
32 | 32 |
|
33 | 33 | from collections import defaultdict |
34 | | -from functools import partialmethod |
35 | 34 | import itertools |
36 | 35 | import math |
37 | 36 | import textwrap |
@@ -71,6 +70,11 @@ class Axes3D(Axes): |
71 | 70 | As a user, you do not instantiate Axes directly, but use Axes creation |
72 | 71 | methods instead; e.g. from `.pyplot` or `.Figure`: |
73 | 72 | `~.pyplot.subplots`, `~.pyplot.subplot_mosaic` or `.Figure.add_axes`. |
| 73 | +
|
| 74 | + .. note:: |
| 75 | +
|
| 76 | + Some of the inherited behavior of Axes is not applicable to 3d and will raise |
| 77 | + an `.UnsupportedError`. |
74 | 78 | """ |
75 | 79 | name = '3d' |
76 | 80 |
|
@@ -1197,16 +1201,16 @@ def set_zscale(self, value, **kwargs): |
1197 | 1201 | """ |
1198 | 1202 | self._set_axis_scale(self.zaxis, value, **kwargs) |
1199 | 1203 |
|
1200 | | - def _raise_semilog_not_implemented(self, name, *args, **kwargs): |
1201 | | - raise NotImplementedError( |
1202 | | - f"Axes3D does not support {name}. Use ax.set_xscale/set_yscale/set_zscale " |
1203 | | - "and ax.plot(...) instead." |
1204 | | - ) |
| 1204 | + twinx = _api.unsupported_method() |
| 1205 | + twiny = _api.unsupported_method() |
| 1206 | + secondary_xaxis = _api.unsupported_method() |
| 1207 | + secondary_yaxis = _api.unsupported_method() |
1205 | 1208 |
|
1206 | | - semilogx = partialmethod(_raise_semilog_not_implemented, "semilogx") |
1207 | | - semilogy = partialmethod(_raise_semilog_not_implemented, "semilogy") |
1208 | | - semilogz = partialmethod(_raise_semilog_not_implemented, "semilogz") |
1209 | | - loglog = partialmethod(_raise_semilog_not_implemented, "loglog") |
| 1209 | + _msg = "Use ax.set_xscale/set_yscale/set_zscale and ax.plot(...) instead." |
| 1210 | + semilogx = _api.unsupported_method(append_message=_msg) |
| 1211 | + semilogy = _api.unsupported_method(append_message=_msg) |
| 1212 | + semilogz = _api.unsupported_method(append_message=_msg) |
| 1213 | + loglog = _api.unsupported_method(append_message=_msg) |
1210 | 1214 |
|
1211 | 1215 | get_zticks = _axis_method_wrapper("zaxis", "get_ticklocs") |
1212 | 1216 | set_zticks = _axis_method_wrapper("zaxis", "set_ticks") |
|
0 commit comments