#!usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author: Caramel
@file: 2.2.py
@time: 2020/03/04
@desc:文字
"""
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(-10, 11)
y = x**2
plt.text(-2, 40, 'function:y = x**2', family='serif', size=20, style='italic', weight=0)
plt.text(-2, 70, 'function:y = x**2', family='sans-serif', size=20, style='oblique', weight=1000, bbox=dict(facecolor='r', alpha=0.2))
#参数解释,前两个是起始坐标,然后是文字,family是字体,size是大小,style是斜体,weight是调整粗体,bbox是指荧光线
plt.plot(x, y)
plt.show()
Matplotlib可视化(十九)-- 文字
最新推荐文章于 2024-05-28 11:24:10 发布