gpt4 book ai didi

python - matplotlib:(xx-small、x-small、small、medium、large、x-large、xx-large、large、smaller)特殊尺寸的值

转载 作者:行者123 更新时间:2023-12-03 23:27:03 34 4
gpt4 key购买 nike

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

这些“特殊文字大小”的 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()

输出
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

关于python - matplotlib:(xx-small、x-small、small、medium、large、x-large、xx-large、large、smaller)特殊尺寸的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62288898/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com