MCPcopy
hub / github.com/matplotlib/matplotlib / test_format_coord

Function test_format_coord

lib/mpl_toolkits/mplot3d/tests/test_axes3d.py:2295–2323  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2293
2294
2295def 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
2326def test_get_axis_position():

Callers

nothing calls this directly

Calls 7

figureMethod · 0.80
add_subplotMethod · 0.80
view_initMethod · 0.80
set_proj_typeMethod · 0.80
plotMethod · 0.45
drawMethod · 0.45
format_coordMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…