diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 612a628f32a7..9d93e22e0641 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -908,12 +908,12 @@ def cla(self): ) self._left_title = mtext.Text( x=0.0, y=1.0, text='', - fontproperties=props, + fontproperties=props.copy(), verticalalignment='baseline', horizontalalignment='left', ) self._right_title = mtext.Text( x=1.0, y=1.0, text='', - fontproperties=props, + fontproperties=props.copy(), verticalalignment='baseline', horizontalalignment='right', ) diff --git a/lib/matplotlib/tests/baseline_images/test_axes_titles/axes_titles.pdf b/lib/matplotlib/tests/baseline_images/test_axes_titles/axes_titles.pdf new file mode 100644 index 000000000000..572c07e6e745 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_axes_titles/axes_titles.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_axes_titles/axes_titles.png b/lib/matplotlib/tests/baseline_images/test_axes_titles/axes_titles.png new file mode 100644 index 000000000000..238d6a9b0f0a Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_axes_titles/axes_titles.png differ diff --git a/lib/matplotlib/tests/baseline_images/test_axes_titles/axes_titles.svg b/lib/matplotlib/tests/baseline_images/test_axes_titles/axes_titles.svg new file mode 100644 index 000000000000..3a8468db0dad --- /dev/null +++ b/lib/matplotlib/tests/baseline_images/test_axes_titles/axes_titles.svg @@ -0,0 +1,970 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/matplotlib/tests/test_axes_titles.py b/lib/matplotlib/tests/test_axes_titles.py new file mode 100644 index 000000000000..661c08ae36d1 --- /dev/null +++ b/lib/matplotlib/tests/test_axes_titles.py @@ -0,0 +1,16 @@ +import numpy as np +import matplotlib +from matplotlib.testing.decorators import image_comparison +import matplotlib.pyplot as plt + + +@image_comparison(baseline_images=['axes_titles']) +def test_axes_titles(): + # Related to issue #3327 + fig = plt.figure() + ax1 = fig.add_subplot(211) + ax1.set_title('center', loc='center', fontsize=20, fontweight=700) + ax1.set_title('left', loc='left', fontsize=10, fontweight=400) + ax2 = fig.add_subplot(212) + ax2.set_title('left', loc='left', fontsize=10, fontweight=400) + ax2.set_title('center', loc='center', fontsize=20, fontweight=700)