Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 86d0f0f

Browse files
authored
Merge pull request #25783 from anntzer/dtp
Cleanup demo_text_path.
2 parents 03da884 + c9fe8f3 commit 86d0f0f

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

galleries/examples/text_labels_and_annotations/demo_text_path.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ def draw(self, renderer=None):
5454
arr = plt.imread(get_sample_data("grace_hopper.jpg"))
5555

5656
text_path = TextPath((0, 0), "!?", size=150)
57-
p = PathClippedImagePatch(text_path, arr, ec="k",
58-
transform=IdentityTransform())
57+
p = PathClippedImagePatch(text_path, arr, ec="k")
5958

6059
# make offset box
6160
offsetbox = AuxTransformBox(IdentityTransform())
@@ -73,10 +72,8 @@ def draw(self, renderer=None):
7372
]:
7473
text_path = TextPath((0, 0), string, size=20, usetex=usetex)
7574

76-
p1 = PathPatch(text_path, ec="w", lw=3, fc="w", alpha=0.9,
77-
transform=IdentityTransform())
78-
p2 = PathPatch(text_path, ec="none", fc="k",
79-
transform=IdentityTransform())
75+
p1 = PathPatch(text_path, ec="w", lw=3, fc="w", alpha=0.9)
76+
p2 = PathPatch(text_path, ec="none", fc="k")
8077

8178
offsetbox2 = AuxTransformBox(IdentityTransform())
8279
offsetbox2.add_artist(p1)
@@ -95,7 +92,7 @@ def draw(self, renderer=None):
9592

9693
# EXAMPLE 2
9794

98-
arr = np.arange(256).reshape(1, 256) / 256
95+
arr = np.arange(256).reshape(1, 256)
9996

10097
for usetex, xpos, string in [
10198
(False, 0.25,
@@ -105,9 +102,7 @@ def draw(self, renderer=None):
105102
r"\frac{-e^{i\pi}}{2^n}\right]$!"),
106103
]:
107104
text_path = TextPath((0, 0), string, size=40, usetex=usetex)
108-
text_patch = PathClippedImagePatch(text_path, arr, ec="none",
109-
transform=IdentityTransform())
110-
105+
text_patch = PathClippedImagePatch(text_path, arr, ec="none")
111106
shadow1 = Shadow(text_patch, 1, -1, fc="none", ec="0.6", lw=3)
112107
shadow2 = Shadow(text_patch, 1, -1, fc="0.3", ec="none")
113108

0 commit comments

Comments
 (0)