import matplotlib.pyplot as plt
import numpy as np
颜色 color或c
x = np.arange(0,10,0.1)
plt.plot(x,np.sin(x),'r')

color = 'r'
color = 'red'
color = '#66ccff'
color = '#8866ccff',88代表透明度
color = (0.3,0.3,0.4) 红0.3,绿0.3,蓝0.4
alpha = 0.5 透明度

背景色
x = np.arange(0,10,0.1)
#使用面型对象的画图方法
axes = plt.subplot(facecolor='red')
axes.plot(x,np.sin(x))

线形 ls
np.arange(-np.pi,np.pi,0.1)
plt.plot(x,np.sin(x),ls='steps')

线宽 lw
我们可以用字符串来控制线条的属性,事实上还可以通过关键词来改变线条的性质,例如 linwidth 可以改变线条的宽度,color 可以改变线条的颜色
np.arange(-np.pi,np.pi,0.1)
plt.plot(x,np.sin(x),ls='steps',lw=5)

text() 在 Axes 对象的任意位置添加文本
xlabel() 添加 x 轴标题
ylabel() 添加 y 轴标题
title() 给 Axes 对象添加标题
figtext() 在 Figure 对象的任意位置添加文本
网友评论