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 fb49ef8 commit 2660b18Copy full SHA for 2660b18
lib/matplotlib/tests/test_figure.py
@@ -382,3 +382,14 @@ def test_figure_repr():
382
def test_fspath(fmt):
383
from pathlib import Path
384
plt.savefig(Path(os.devnull), format=fmt)
385
+
386
387
+def test_tightbbox():
388
+ fig, ax = plt.subplots()
389
+ ax.set_xlim(0, 1)
390
+ t = ax.text(1., 0.5, 'This dangles over end')
391
+ renderer = fig.canvas.get_renderer()
392
+ assert np.abs(t.get_tightbbox(renderer).x1 - 9.035 * fig.dpi) < 2
393
+ assert np.abs(ax.get_tightbbox(renderer).x1 - 9.035 * fig.dpi) < 2
394
+ assert np.abs(fig.get_tightbbox(renderer).x1 - 9.035) < 0.05
395
+ assert np.abs(fig.get_tightbbox(renderer).x0 - 0.679) < 0.05
0 commit comments