Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9158276

Browse filesBrowse files
authored
Merge pull request #16359 from anntzer/copy-usetex
MNT: Make Text.update_from copy usetex state.
2 parents a7501f9 + 6c76bbd commit 9158276
Copy full SHA for 9158276

File tree

Expand file treeCollapse file tree

3 files changed

+19
-0
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+19
-0
lines changed

‎doc/api/next_api_changes/behaviour.rst

Copy file name to clipboardExpand all lines: doc/api/next_api_changes/behaviour.rst
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,6 @@ shape ``(n, 2)`` would plot the first column of *x* against the first column
7070
of *y*, the second column of *x* against the second column of *y*, **and** the
7171
first column of *x* against the third column of *y*. This now raises an error
7272
instead.
73+
74+
`.Text.update_from` now copies usetex state from the source Text
75+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

‎lib/matplotlib/tests/test_text.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_text.py
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,21 @@ def test_hinting_factor_backends():
532532
rtol=0.1)
533533

534534

535+
@needs_usetex
536+
def test_usetex_is_copied():
537+
# Indirectly tests that update_from (which is used to copy tick label
538+
# properties) copies usetex state.
539+
fig = plt.figure()
540+
plt.rcParams["text.usetex"] = False
541+
ax1 = fig.add_subplot(121)
542+
plt.rcParams["text.usetex"] = True
543+
ax2 = fig.add_subplot(122)
544+
fig.canvas.draw()
545+
for ax, usetex in [(ax1, False), (ax2, True)]:
546+
for t in ax.xaxis.majorTicks:
547+
assert t.label1.get_usetex() == usetex
548+
549+
535550
@needs_usetex
536551
def test_single_artist_usetex():
537552
# Check that a single artist marked with usetex does not get passed through

‎lib/matplotlib/text.py

Copy file name to clipboardExpand all lines: lib/matplotlib/text.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ def update_from(self, other):
262262
self._verticalalignment = other._verticalalignment
263263
self._horizontalalignment = other._horizontalalignment
264264
self._fontproperties = other._fontproperties.copy()
265+
self._usetex = other._usetex
265266
self._rotation = other._rotation
266267
self._picker = other._picker
267268
self._linespacing = other._linespacing

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.