1, 填充
fill正常就画出来曲线了,然后填充了正常将于x轴围成的区域填充。
plt.vlines(Sim_T, [0], 1, color="green", linewidth=3, linestyles="dashed")
ax.fill_betweenx(p, Sim_T, s, facecolor="orange", color="white")
2,建立子图--设置坐标轴属性----这个代码相当值得学习了。
fig.tight_layout(); 这条语句最好加上,每一个子图后面都要加上
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 5 * np.pi, 1000)
y1 = np.sin(x)
fig = plt.figure(figsize=(15, 8), dpi=80)
axs = fig.subplots(3, 3, sharex=True, sharey=True)
'''图一'''
axs[0,0].fill(x, y1, color="g", alpha=0.3) # 正常情况下
fig.tight_layout(); # 当子图存在时候,这条语句最好加上
'''图二'''
axs[0,1].fill(x, y1, color="g", alpha=0.3)
axs[0,1].spines['right'].set_visible(False) # 第二张图的效果,容易理解
fig.tight_layout();
'''图三'''
axs[0,2].fill(x, y1, color="g", alpha=0.3) # 三,
axs[0,2].spines['bottom'].set_position(('data',0)) # 这个语句将坐标轴移到了中间了。 0 代表:将横轴移动到了y = 0的位置。
axs[0,2].spines['left'].set_position(('data',0)) # 将纵轴移动到x=0的位置
fig.tight_layout();
'''图四'''
axs[1,0].fill(x, y1, color="g", alpha=0.3)
axs[1,0].spines['top'].set_color('none') # 第四张图的效果,容易理解
fig.tight_layout();
'''图五'''
axs[1,1].fill(x, y1, color="g", alpha=0.3)
axs[1,1].xaxis.set_ticks_position('top') # 第五张图的效果,tick变到上面了。
axs[1,1].yaxis.set_ticks_position('right')
fig.tight_layout();
'''图六'''
axs[1,2].fill(x, y1, color="g", alpha=0.3)
axs[1,2].spines['left'].set_position(('data',0)) # 将纵轴移动到0的位置
fig.tight_layout();
'''图七'''
axs[2,0].set_title('picture 7 title ')
axs[2,0].annotate('zhu shi ', xy=(0, 0))
fig.tight_layout();
plt.show()
柱状图:
https://www.cnblogs.com/linyujin/p/9895328.html
不同的子图画不同的图像,比如1图画散点图,二图画柱状图subplot2grid
函数subplot2grid()的使用方法
http://book.51cto.com/art/201809/584017.htm