Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. x=np.array(x)
  2. y=np.array(y)
  3. z=np.array(z)
  4. xi=np.linspace(minx,maxx,100)
  5. yi=np.linspace(miny,maxy,100)
  6. zi=griddata(x,y,z,xi,yi)
  7.  
  8. plt.contour(xi,yi,zi)
  9. plt.pcolormesh(xi,yi,zi,cmap=plt.get_cmap('PRGn'),norm=plt.Normalize(-10,10),vmin=-10,vmax=10)
  10.  
  11. import numpy as np
  12. import matplotlib.pyplot as plt
  13. y, x = np.ogrid[-1.5:1.5:200j, -1.5:1.5:200j]
  14. f = (x**2 + y**2)**4 - (x**2 - y**2)**2
  15.  
  16. plt.figure(figsize=(9,4))
  17. plt.subplot(121)
  18. extent = [np.min(x), np.max(x), np.min(y), np.max(y)]
  19. cs = plt.contour(f, extent=extent, levels=[0.1],
  20. colors=["b", "r"], linestyles=["solid", "dashed"], linewidths=[2, 2])
  21.  
  22. plt.subplot(122)
  23. # get the points on the lines
  24. for c in cs.collections:
  25. data = c.get_paths()[0].vertices
  26. plt.plot(data[:,0], data[:,1],
  27. color=c.get_color()[0], linewidth=c.get_linewidth()[0])
  28.  
  29. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement