資源簡介
代碼片段和文件信息
#?-*-?coding:?utf-8?-*-
“““
Created?on?Fri?Jan?19?17:35:17?2018
@author:?administrator
“““
import?matplotlib.pyplot?as?plt
from?matplotlib.colors?import?BoundaryNorm
from?matplotlib.ticker?import?MaxNLocator
import?numpy?as?np
#?make?these?smaller?to?increase?the?resolution
dx?dy?=?0.05?0.05
#?generate?2?2d?grids?for?the?x?&?y?bounds
y?x?=?np.mgrid[slice(1?5?+?dy?dy)
????????????????slice(1?5?+?dx?dx)]
z?=?np.sin(x)**10?+?np.cos(10?+?y*x)?*?np.cos(x)
#?x?and?y?are?bounds?so?z?should?be?the?value?*inside*?those?bounds.
#?Therefore?remove?the?last?value?from?the?z?array.
z?=?z[:-1?:-1]
levels?=?MaxNLocator(nbins=15).tick_values(z.min()?z.max())
#?pick?the?desired?colormap?sensible?levels
- 上一篇:python實現Gui 自動化測試
- 下一篇:python:12306實現購票
評論
共有 條評論