def droplet(height, width, data_type=numpy.double): """Generate grid of droplets""" x = numpy.linspace(-1, 1, num=width, endpoint=True).astype(data_type) y = numpy.linspace(-1, 1, num=width, endpoint=True).astype(data_type) (xx, yy) = ndgrid(x, y) droplet = height * numpy.exp(-5 * (xx ** 2 + yy ** 2)) return droplet
def __init__( self, n, ): plt.ion() # First parameter is a figure number, second is size in inches self.fig = plt.figure(11, (8, 8)) self.ax = self.fig.add_subplot(111, projection='3d') self.ax.set_zlim3d(-2, 3) self.wframe = None (self.X, self.Y) = ndgrid(numpy.linspace(0, n, n), numpy.linspace(0, n, n))