Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x=np.array(x)
- y=np.array(y)
- z=np.array(z)
- xi=np.linspace(minx,maxx,100)
- yi=np.linspace(miny,maxy,100)
- zi=griddata(x,y,z,xi,yi)
- plt.contour(xi,yi,zi)
- plt.pcolormesh(xi,yi,zi,cmap=plt.get_cmap('PRGn'),norm=plt.Normalize(-10,10),vmin=-10,vmax=10)
- import numpy as np
- import matplotlib.pyplot as plt
- y, x = np.ogrid[-1.5:1.5:200j, -1.5:1.5:200j]
- f = (x**2 + y**2)**4 - (x**2 - y**2)**2
- plt.figure(figsize=(9,4))
- plt.subplot(121)
- extent = [np.min(x), np.max(x), np.min(y), np.max(y)]
- cs = plt.contour(f, extent=extent, levels=[0.1],
- colors=["b", "r"], linestyles=["solid", "dashed"], linewidths=[2, 2])
- plt.subplot(122)
- # get the points on the lines
- for c in cs.collections:
- data = c.get_paths()[0].vertices
- plt.plot(data[:,0], data[:,1],
- color=c.get_color()[0], linewidth=c.get_linewidth()[0])
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement