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

Skip to content

Commit 44529d9

Browse files
author
Avasis AI
committed
docs: fix fontweight options in text properties table
1 parent dde0763 commit 44529d9

1 file changed

Lines changed: 89 additions & 49 deletions

File tree

galleries/users_explain/text/text_props.py

Lines changed: 89 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
variant [ ``'normal'`` | ``'small-caps'`` ]
4242
verticalalignment or va [ ``'center'`` | ``'top'`` | ``'bottom'`` | ``'baseline'`` ]
4343
visible bool
44-
weight or fontweight [ ``'normal'`` | ``'bold'`` | ``'heavy'`` | ``'light'`` | ``'ultrabold'`` | ``'ultralight'``]
44+
weight or fontweight [ ``'ultralight'`` | ``'light'`` | ``'normal'`` | ``'semibold'`` | ``'bold'`` | ``'heavy'`` | ``'extra bold'`` | ``'black'``]
4545
x `float`
4646
y `float`
4747
zorder any number
@@ -82,66 +82,106 @@
8282

8383
# axes coordinates: (0, 0) is bottom left and (1, 1) is upper right
8484
p = patches.Rectangle(
85-
(left, bottom), width, height,
86-
fill=False, transform=ax.transAxes, clip_on=False
87-
)
85+
(left, bottom), width, height, fill=False, transform=ax.transAxes, clip_on=False
86+
)
8887

8988
ax.add_patch(p)
9089

91-
ax.text(left, bottom, 'left top',
92-
horizontalalignment='left',
93-
verticalalignment='top',
94-
transform=ax.transAxes)
90+
ax.text(
91+
left,
92+
bottom,
93+
"left top",
94+
horizontalalignment="left",
95+
verticalalignment="top",
96+
transform=ax.transAxes,
97+
)
9598

96-
ax.text(left, bottom, 'left bottom',
97-
horizontalalignment='left',
98-
verticalalignment='bottom',
99-
transform=ax.transAxes)
99+
ax.text(
100+
left,
101+
bottom,
102+
"left bottom",
103+
horizontalalignment="left",
104+
verticalalignment="bottom",
105+
transform=ax.transAxes,
106+
)
100107

101-
ax.text(right, top, 'right bottom',
102-
horizontalalignment='right',
103-
verticalalignment='bottom',
104-
transform=ax.transAxes)
108+
ax.text(
109+
right,
110+
top,
111+
"right bottom",
112+
horizontalalignment="right",
113+
verticalalignment="bottom",
114+
transform=ax.transAxes,
115+
)
105116

106-
ax.text(right, top, 'right top',
107-
horizontalalignment='right',
108-
verticalalignment='top',
109-
transform=ax.transAxes)
117+
ax.text(
118+
right,
119+
top,
120+
"right top",
121+
horizontalalignment="right",
122+
verticalalignment="top",
123+
transform=ax.transAxes,
124+
)
110125

111-
ax.text(right, bottom, 'center top',
112-
horizontalalignment='center',
113-
verticalalignment='top',
114-
transform=ax.transAxes)
126+
ax.text(
127+
right,
128+
bottom,
129+
"center top",
130+
horizontalalignment="center",
131+
verticalalignment="top",
132+
transform=ax.transAxes,
133+
)
115134

116-
ax.text(left, 0.5*(bottom+top), 'right center',
117-
horizontalalignment='right',
118-
verticalalignment='center',
119-
rotation='vertical',
120-
transform=ax.transAxes)
135+
ax.text(
136+
left,
137+
0.5 * (bottom + top),
138+
"right center",
139+
horizontalalignment="right",
140+
verticalalignment="center",
141+
rotation="vertical",
142+
transform=ax.transAxes,
143+
)
121144

122-
ax.text(left, 0.5*(bottom+top), 'left center',
123-
horizontalalignment='left',
124-
verticalalignment='center',
125-
rotation='vertical',
126-
transform=ax.transAxes)
145+
ax.text(
146+
left,
147+
0.5 * (bottom + top),
148+
"left center",
149+
horizontalalignment="left",
150+
verticalalignment="center",
151+
rotation="vertical",
152+
transform=ax.transAxes,
153+
)
127154

128-
ax.text(0.5*(left+right), 0.5*(bottom+top), 'middle',
129-
horizontalalignment='center',
130-
verticalalignment='center',
131-
fontsize=20, color='red',
132-
transform=ax.transAxes)
155+
ax.text(
156+
0.5 * (left + right),
157+
0.5 * (bottom + top),
158+
"middle",
159+
horizontalalignment="center",
160+
verticalalignment="center",
161+
fontsize=20,
162+
color="red",
163+
transform=ax.transAxes,
164+
)
133165

134-
ax.text(right, 0.5*(bottom+top), 'centered',
135-
horizontalalignment='center',
136-
verticalalignment='center',
137-
rotation='vertical',
138-
transform=ax.transAxes)
166+
ax.text(
167+
right,
168+
0.5 * (bottom + top),
169+
"centered",
170+
horizontalalignment="center",
171+
verticalalignment="center",
172+
rotation="vertical",
173+
transform=ax.transAxes,
174+
)
139175

140-
ax.text(left, top, 'rotated\nwith newlines',
141-
horizontalalignment='center',
142-
verticalalignment='center',
143-
rotation=45,
144-
transform=ax.transAxes)
176+
ax.text(
177+
left,
178+
top,
179+
"rotated\nwith newlines",
180+
horizontalalignment="center",
181+
verticalalignment="center",
182+
rotation=45,
183+
transform=ax.transAxes,
184+
)
145185

146186
ax.set_axis_off()
147187
plt.show()

0 commit comments

Comments
 (0)