该matplotlibrc
样本文件指出:
## The font.size property is the default font size for text, given in pts.
## 10 pt is the standard value.
##
## Note that font.size controls default text sizes. To configure
## special text sizes tick labels, axes, labels, title, etc, see the rc
## settings for axes and ticks. Special text sizes can be defined
## relative to font.size, using the following values: xx-small, x-small,
## small, medium, large, x-large, xx-large, larger, or smaller
Run Code Online (Sandbox Code Playgroud)
这些“特殊文字大小”的 pts 等效值是多少?
您也可以很容易地自己计算绝对字体大小
import matplotlib as mpl
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
t = ax.text(0.5, 0.5, 'Text')
fonts = ['xx-small', 'x-small', 'small', 'medium', 'large',
'x-large', 'xx-large', 'larger', 'smaller']
for font in fonts:
t.set_fontsize(font)
print (font, round(t.get_fontsize(), 2))
plt.close()
Run Code Online (Sandbox Code Playgroud)
输出
xx-small 5.79
x-small 6.94
small 8.33
medium 10.0
large 12.0
x-large 14.4
xx-large 17.28
larger 12.0
smaller 8.33
Run Code Online (Sandbox Code Playgroud)
我认为这些是按相对大小进行缩放的,请参阅此处和此处的文档/代码:
大小:“xx-small”、“x-small”、“small”、“medium”、“large”、“x-large”、“xx-large”的相对值或绝对字体大小,例如, 12
font_scalings = {
'xx-small' : 0.579,
'x-small' : 0.694,
'small' : 0.833,
'medium' : 1.0,
'large' : 1.200,
'x-large' : 1.440,
'xx-large' : 1.728,
'larger' : 1.2,
'smaller' : 0.833,
None : 1.0}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1640 次 |
最近记录: |