FontProperties介绍 |
您所在的位置:网站首页 › fontproperties函数 › FontProperties介绍 |
【matplotlib.pyplot在图形上显示中文】 plt.rcParams['font.sans-serif']=['STSong'] ## 中文宋体 plt.rcParams['font.sans-serif']=['SimHei'] ## 中文黑体 plt.rcParams['font.sans-serif']=['Kaiti'] ## 中文楷体 plt.rcParams['font.sans-serif']=['Lisu'] ## 中文隶书 plt.rcParams['font.sans-serif']=['FangSong'] ## 中文仿宋 plt.rcParams['font.sans-serif']=['YouYuan'] ## 中文幼圆 FontProperties有6个属性可以供修改。它们分别为:family,style,variant,stretch,weight,size. family:‘serif’, ‘sans-serif’, ‘cursive’, ‘fantasy’, or ‘monospace’为最常用的Serif 在印刷学上指衬线字体。衬线字体有 Georgia, Garamond, Times New Roman, 中文的宋体。 sans-serif就是无衬线字体。无衬线字体比较圆滑,线条一般粗细均匀。比较适合用作艺术字、标题等。因此sans-serif一般不适用于绘图的axes,legend等。 cursive即为手写字体。可以用在特殊手写效果的绘图上。 fantasy梦幻字体,非常有艺术感。 monospace。等宽字体,可以使得英文字母等宽。 最后推荐使用serif的Times New Roman字体。可以实现论文写作一体化。 style: Either ‘normal’, ‘italic’ or ‘oblique’.italic和oblique都是向右倾斜的文字, 但区别在于Italic是指斜体字,而Oblique是倾斜的文字,对于没有斜体的字体应该使用Oblique属性值来实现倾斜的文字效果. 一般倾斜用italic就行。 variant: Either ‘normal’ or ‘small-caps’.该属性针对英文字母,small-caps把段落设置为小型大写字母字体。 stretch: A numeric value in the range 0-1000 or one of ‘ultra-condensed’, ‘extra-condensed’, ‘condensed’, ‘semi-condensed’, ‘normal’, ‘semi-expanded’, ‘expanded’, ‘extra-expanded’ or ‘ultra-expanded’该属性对字体进行拉伸。ultra-condensed" 是最宽的值,而 "ultra-expanded" 是最窄的值。该属性基本用不到,不作多余叙述。 weight: A numeric value in the range 0-1000 or one of ‘ultralight’, ‘light’, ‘normal’, ‘regular’, ‘book’, ‘medium’, ‘roman’, ‘semibold’, ‘demibold’, ‘demi’, ‘bold’, ‘heavy’, ‘extra bold’, ‘black’weight定义字体粗细,blod,定义粗体字符。bolder ,定义更粗的字符。lighter 定义更细的字符。数字定义由粗到细的字符。400 等同于 normal,而 700 等同于 bold。 size: Either an relative value of ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’ or an absolute font size, e.g., 12把字体的尺寸设置为不同的尺寸,从 xx-small 到 xx-large。默认值:medium。 推荐设置推荐使用rcParams进行设置。在进行rcParams进行设置时一般采用字典配置rcParams。 params={‘font.family':'serif', 'font.serif':'Times New Roman', 'font.style':'italic', 'font.weight':'normal', #or 'blod' 'font.size':'medium',#or large,small }rcParams.update(params) |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |