()
| 2293 | |
| 2294 | |
| 2295 | def test_format_coord(): |
| 2296 | fig = plt.figure() |
| 2297 | ax = fig.add_subplot(projection='3d') |
| 2298 | x = np.arange(10) |
| 2299 | ax.plot(x, np.sin(x)) |
| 2300 | xv = 0.1 |
| 2301 | yv = 0.1 |
| 2302 | fig.canvas.draw() |
| 2303 | assert ax.format_coord(xv, yv) == 'x=10.5227, y pane=1.0417, z=0.1444' |
| 2304 | |
| 2305 | # Modify parameters |
| 2306 | ax.view_init(roll=30, vertical_axis="y") |
| 2307 | fig.canvas.draw() |
| 2308 | assert ax.format_coord(xv, yv) == 'x pane=9.1875, y=0.9761, z=0.1291' |
| 2309 | |
| 2310 | # Reset parameters |
| 2311 | ax.view_init() |
| 2312 | fig.canvas.draw() |
| 2313 | assert ax.format_coord(xv, yv) == 'x=10.5227, y pane=1.0417, z=0.1444' |
| 2314 | |
| 2315 | # Check orthographic projection |
| 2316 | ax.set_proj_type('ortho') |
| 2317 | fig.canvas.draw() |
| 2318 | assert ax.format_coord(xv, yv) == 'x=10.8869, y pane=1.0417, z=0.1528' |
| 2319 | |
| 2320 | # Check non-default perspective projection |
| 2321 | ax.set_proj_type('persp', focal_length=0.1) |
| 2322 | fig.canvas.draw() |
| 2323 | assert ax.format_coord(xv, yv) == 'x=9.0620, y pane=1.0417, z=0.1110' |
| 2324 | |
| 2325 | |
| 2326 | def test_get_axis_position(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…