Skip to content

Commit 294ec14

Browse files
Document relative font sizes
1 parent 1c3e043 commit 294ec14

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

galleries/users_explain/text/text_props.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
picker [None|float|bool|callable]
3535
position (x, y)
3636
rotation [ angle in degrees | ``'vertical'`` | ``'horizontal'`` ]
37-
size or fontsize [ size in points | relative size, e.g., ``'smaller'``, ``'x-large'`` ]
37+
size or fontsize [ size in points | relative size, e.g., ``'small'``, ``'x-large'`` ]
3838
style or fontstyle [ ``'normal'`` | ``'italic'`` | ``'oblique'`` ]
3939
text string or anything printable with '%s' conversion
4040
transform `~matplotlib.transforms.Transform` subclass
@@ -48,6 +48,9 @@
4848
========================== ======================================================================================================================
4949
5050
51+
Text alignment
52+
==============
53+
5154
You can lay out text with the alignment arguments
5255
``horizontalalignment``, ``verticalalignment``, and
5356
``multialignment``. ``horizontalalignment`` controls whether the x
@@ -69,8 +72,8 @@
6972
import matplotlib.patches as patches
7073

7174
# build a rectangle in axes coords
72-
left, width = .25, .5
73-
bottom, height = .25, .5
75+
left, width = 0.25, 0.5
76+
bottom, height = 0.25, 0.5
7477
right = left + width
7578
top = bottom + height
7679

@@ -144,6 +147,25 @@
144147
plt.show()
145148

146149
# %%
150+
# Relative font sizes
151+
# ===================
152+
#
153+
# Font sizes can be specified in points, or as a string that indicates the size
154+
# relative to the default font size. The following are valid values for relative font sizes:
155+
#
156+
# ==================== ================================
157+
# Relative font size Scaling of default font size
158+
# ==================== ================================
159+
# xx-small 0.579
160+
# x-small 0.694
161+
# small 0.833
162+
# medium 1.000
163+
# large 1.200
164+
# x-large 1.440
165+
# xx-large 1.728
166+
# ==================== ================================
167+
#
168+
#
147169
# ==============
148170
# Default Font
149171
# ==============

0 commit comments

Comments
 (0)