# -*- 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())
评论
共有 条评论