poormans_contour.py

来自「非原创。很好的python例子」· Python 代码 · 共 29 行

PY
29
字号
#!/usr/bin/env python"""Use a pcolor or imshow with a custom colormap to make a contour plot.Since this example was initially written, a proper contour routine wasadded to matplotlib - see contour_demo.py andhttp://matplotlib.sf.net/matplotlib.pylab.html#-contour."""from pylab import *delta = 0.01x = arange(-3.0, 3.0, delta)y = arange(-3.0, 3.0, delta)X,Y = meshgrid(x, y)Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)Z = Z2 - Z1 # difference of Gaussianscmap = cm.get_cmap('jet', 10)    # 10 discrete colorsim = imshow(Z, cmap=cmap, interpolation='bilinear')axis('off')colorbar(tickfmt='%1.2f')#savefig('test')show()

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?