matplotlib.pyplot.text()结构及用法||参数详解

matplotlib.pyplot.text(x, y, s, fontdict=None, withdash=False, **kwargs)

通过函数方式,向 a x e s axes axes对象添加 t e x t text text对象,确切的说是向 a x e s axes axes ( x , y ) (x,y) (x,y)位置添加 s s s文本。返回一个text实例。

  • 参数详解

  1. x, y : scalars 防止text的位置

  2. s : str 内容text

  3. fontdict : dictionary, optional, default: None 一个定义s格式的dict

  4. withdash : boolean, optional, default: False。如果True则创建一个 TextWithDash实例。

    以下为其他常用参数1

  5. fontsize设置字体大小,默认12,可选参数 [‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’,‘x-large’, ‘xx-large’]

  6. fontweight设置字体粗细,可选参数 [‘light’, ‘normal’, ‘medium’, ‘semibold’, ‘bold’, ‘heavy’, ‘black’]

  7. fontstyle设置字体类型,可选参数[ ‘normal’ | ‘italic’ | ‘oblique’ ],italic斜体,oblique倾斜

  8. verticalalignment设置水平对齐方式 ,可选参数 : ‘center’ , ‘top’ , ‘bottom’ ,‘baseline’

  9. horizontalalignment设置垂直对齐方式,可选参数:left,right,center

  10. rotation(旋转角度)可选参数为:vertical,horizontal 也可以为数字

  11. alpha透明度,参数值0至1之间

  12. backgroundcolor标题背景颜色

  13. bbox给标题增加外框 ,常用参数如下:

    1. boxstyle方框外形
    2. facecolor(简写fc)背景颜色
    3. edgecolor(简写ec)边框线条颜色
    4. edgewidth边框线条大小
  • Reference


  1. matplotlib命令与格式:标题(title),标注(annotate),文字说明(text) ↩︎

  • 16
    点赞
  • 122
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值