8000
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 cdc3ab1 commit edeccc6Copy full SHA for edeccc6
lib/matplotlib/tests/test_text.py
@@ -349,6 +349,19 @@ def test_get_rotation_mod360():
349
assert_almost_equal(text.get_rotation(i), j)
350
351
352
+@pytest.mark.parametrize("ha", ["center", "right", "left"])
353
+@pytest.mark.parametrize("va", ["center", "top", "bottom",
354
+ "baseline", "center_baseline"])
355
+def test_null_rotation_with_rotation_mode(ha, va):
356
+ fig, ax = plt.subplots()
357
+ kw = dict(rotation=0, va=va, ha=ha)
358
+ t0 = ax.text(.5, .5, 'test', rotation_mode='anchor', **kw)
359
+ t1 = ax.text(.5, .5, 'test', rotation_mode='default', **kw)
360
+ fig.canvas.draw()
361
+ assert_almost_equal(t0.get_window_extent(fig.canvas.renderer).get_points(),
362
+ t1.get_window_extent(fig.canvas.renderer).get_points())
363
+
364
365
@image_comparison(baseline_images=['text_bboxclip'])
366
def test_bbox_clipping():
367
plt.text(0.9, 0.2, 'Is bbox clipped?', backgroundcolor='r', clip_on=True)
lib/matplotlib/text.py
@@ -403,7 +403,7 @@ def _get_layout(self, renderer):
403
elif valign == 'baseline':
404
offsety = ymax1 - baseline
405
elif valign == 'center_baseline':
406
- offsety = (ymin1 + ymax1 - baseline) / 2.0
+ offsety = ymax1 - baseline / 2.0
407
else:
408
offsety = ymin1
409
0 commit comments