python matplotlib简单示例
2017-09-01 22:48
776 查看
1.1)
图 1.1:
++++++++++++++++++++++++++++++++++++++++
1.2)
图1.2
+++++++++++++++++++++++++++++++++++++
1.3)
图1.3:
++++++++++++++++++++++++++++++++++++++++
1.4)
图 1.4
+++++++++++++++++++++++++++++++++++++++
1.5)
图 1.5:注意这里有两个图版:而不是一张图版里两张。
+++++++++++++++++++++++++++++++++++++++++++++++
1.6)
图1.6:
import matplotlib.pyplot as plt import numpy as np import sys t = np.arange(0.,5,0.2) lines = plt.plot(t,t**2,'-') plt.setp(lines,color='r') #print plt.setp(lines) plt.show(lines)
图 1.1:
++++++++++++++++++++++++++++++++++++++++
1.2)
import numpy as np import matplotlib.pyplot as plt t = np.arange(0., 5., 0.2) plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^') plt.show()
图1.2
+++++++++++++++++++++++++++++++++++++
1.3)
import matplotlib.pyplot as plt import numpy as np import sys t = np.arange(0.,5,0.2) def f(t): return np.exp(-t) print f(t) lines1 = plt.plot(t,f(t),'-') lines2 = plt.plot(t,f(2*t),'-') plt.figure(1) plt.setp(lines1,color='r') plt.setp(lines2,color='b') plt.show([lines1,lines2]) #line.show()
图1.3:
++++++++++++++++++++++++++++++++++++++++
1.4)
import matplotlib.pyplot as plt import numpy as np import sys t = np.arange(0.,5,0.2) def f(t): return np.exp(-t) plt.figure(1) plt.subplot(211) plt.plot(t,f(t),'-') plt.subplot(212) plt.plot(t,f(t),'-') plt.show() #line.show()
图 1.4
+++++++++++++++++++++++++++++++++++++++
1.5)
import matplotlib.pyplot as plt plt.figure(1) # the first figure plt.subplot(211) # the first subplot in the first figure plt.plot([1, 2, 3]) plt.subplot(212) # the second subplot in the first figure plt.plot([4, 5, 6]) plt.figure(2)# a second figure plt.plot([4, 5, 6]) # creates a subplot(111) by default plt.figure(1) plt.subplot(211) # make subplot(211) in figure1 current plt.title('Easy as 1, 2, 3') # subplot 211 title plt.show()
图 1.5:注意这里有两个图版:而不是一张图版里两张。
+++++++++++++++++++++++++++++++++++++++++++++++
1.6)
import numpy as np import matplotlib.pyplot as plt # Fixing random state for reproducibility np.random.seed(19680801) mu, sigma = 100, 15 x = mu + sigma * np.random.randn(10000) # the histogram of the data n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75) plt.xlabel('Smarts') plt.ylabel('Probability') plt.title('Histogram of IQ') plt.text(60, .025, r'$\mu=100,\ \sigma=15$') plt.axis([40, 160, 0, 0.03]) plt.grid(True) plt.show()
图1.6:
相关文章推荐
- python matplotlib 注释文本箭头简单代码示例
- Python使用matplotlib简单绘图示例
- 【Python-matplotlib】subplot2grid()函数的简单示例
- Python使用matplotlib绘制多个图形单独显示的方法示例
- Python使用matplotlib填充图形指定区域代码示例
- python绘图---matplotlib几个简单例子
- Python基于matplotlib绘制栈式直方图的方法示例
- Python可视化的扩展模块matplotlib的简单应用
- Python——matplotlib基础绘图函数示例
- python matplotlib 库的示例代码
- python中Matplotlib实现绘制3D图的示例代码
- Python实现的多项式拟合功能示例【基于matplotlib】
- 【Python-3.5】matplotlib做简单折线图
- python爬虫webdriver.Chrome 数据可视化简单案例matplotlib
- Python使用matplotlib实现绘制自定义图形功能示例
- python Matplotlib画图之调整字体大小的示例
- Python使用matplotlib模块绘制图像并设置标题与坐标轴等信息示例
- Python-Matplotlib安装及简单使用
- 使用python中的Matplotlib绘图示例(续)
- python matplotlib 画图保存图片简单例子