Python:matplotlib画图----如何控制画图范围,如何画两条曲线间的阴影,如何控制Y轴现实范围
2017-08-17 21:08
639 查看
import matplotlib.pyplot as plt import numpy as np def func(x): return 5+2*x+3*x**2-0.5*x**3 def fund(x): return 200-10*x #np.linspace()取x的值 x=np.linspace(-10,10,50) y=func(x) y1=fund(x) fig,ax=plt.subplots() plt.plot(x,y,'r-o',lw=1) plt.plot(x,y1,'g-*',lw=1) #plt.ylim(ymin=0) 控制y轴现实范围 a,b=-10,3 xf=x[np.where((x>a)&(x<b))] #plt.fill_between(xf),在xf范围内 # #曲线1:np.zeros(len(xf))与曲线2:func(xf)之间的区域 # #np.zeros()从零开始,np.ones()从1开始,np.ones()*20从20开始 #plt.fill_between(xf, np.zeros(len(xf)), func(xf), color='blue', alpha=.25) # #两条曲线之间的区域 plt.fill_between(xf,func(xf),fund(xf),color='blue',alpha=0.25) plt.show()
相关文章推荐
- python 中matplotlib 画图导入到word中如何保证分辨率
- python 的 matplotlib画图 画曲线图
- python 使用matplotlib画图
- python matplotlib 画图简介
- python matplotlib 画图show()不显示图
- python3使用matplotlib画图支持中文
- 【Python】Matplotlib画图(十一)——箱线图
- windows下python画图matplotlib
- python画图包seaborn和matplotlib中文字体显示(针对windows系统,,使用ipython notebook)
- python matplotlib 画图刻度、图例等字体、字体大小设置
- python matplotlib 生成x的三次方曲线图
- python画图:matplotlib(1)
- python中引用matplotlib画图的几个常用命令及基本步骤
- python matplotlib.pyplot画图设置刻度
- python使用matplotlib画图出现中文乱码
- python matplotlib 绘制双Y轴曲线图
- python 安装画图工具matplotlib
- python matplotlib画图安装和使用
- python中scatter()函数用法,matplotlib画图
- python matplotlib 画图刻度、图例等字体、字体大小设置