Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 26461ef commit ec263c1Copy full SHA for ec263c1
lib/matplotlib/tests/test_figure.py
@@ -386,3 +386,14 @@ def test_fspath(fmt, tmpdir):
386
# All the supported formats include the format name (case-insensitive)
387
# in the first 100 bytes.
388
assert fmt.encode("ascii") in file.read(100).lower()
389
+
390
391
+def test_tightbbox():
392
+ fig, ax = plt.subplots()
393
+ ax.set_xlim(0, 1)
394
+ t = ax.text(1., 0.5, 'This dangles over end')
395
+ renderer = fig.canvas.get_renderer()
396
+ assert np.abs(t.get_tightbbox(renderer).x1 - 9.035 * fig.dpi) < 2
397
+ assert np.abs(ax.get_tightbbox(renderer).x1 - 9.035 * fig.dpi) < 2
398
+ assert np.abs(fig.get_tightbbox(renderer).x1 - 9.035) < 0.05
399
+ assert np.abs(fig.get_tightbbox(renderer).x0 - 0.679) < 0.05
0 commit comments