• 大小: 1.46KB
    文件类型: .py
    金币: 1
    下载: 0 次
    发布日期: 2021-01-30
  • 语言: Python
  • 标签: python  

资源简介


资源截图

代码片段和文件信息

# -*- 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

评论

共有 条评论