| 3346 | |
| 3347 | |
| 3348 | def test_as_mpl_axes_api(): |
| 3349 | # tests the _as_mpl_axes api |
| 3350 | class Polar: |
| 3351 | def __init__(self): |
| 3352 | self.theta_offset = 0 |
| 3353 | |
| 3354 | def _as_mpl_axes(self): |
| 3355 | # implement the matplotlib axes interface |
| 3356 | return PolarAxes, {'theta_offset': self.theta_offset} |
| 3357 | |
| 3358 | prj = Polar() |
| 3359 | prj2 = Polar() |
| 3360 | prj2.theta_offset = np.pi |
| 3361 | |
| 3362 | # testing axes creation with plt.axes |
| 3363 | ax = plt.axes((0, 0, 1, 1), projection=prj) |
| 3364 | assert type(ax) is PolarAxes |
| 3365 | plt.close() |
| 3366 | |
| 3367 | # testing axes creation with subplot |
| 3368 | ax = plt.subplot(121, projection=prj) |
| 3369 | assert type(ax) is PolarAxes |
| 3370 | plt.close() |
| 3371 | |
| 3372 | |
| 3373 | def test_pyplot_axes(): |