Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. leg = []
  2. colors=['red','blue']
  3. count = 0
  4. for key in Xpr: #Xpr holds my data
  5. #skipping over what I don't want to plot
  6. if not key[0] == '5': continue
  7. if key[1] == '0': continue
  8. if key[1] == 'a': continue
  9. leg.append(key)
  10. x = Xpr[key]
  11. y = Ypr[key] #Ypr holds the Y axis and is created when Xpr is created
  12. plt.scatter(x,y,color=colors[count],marker='.')
  13. count += 1
  14.  
  15. plt.xlabel(r'$z/mu$')
  16. plt.ylabel(r'$rho(z)$')
  17. plt.legend(leg)
  18. plt.xlim(0,10)
  19. #Now I wish to create the inset
  20. a=plt.axes([0.7,0.7,0.8,0.8])
  21. count = 0
  22. for key in Xpr:
  23. break
  24. if not key[0] == '5': continue
  25. if key[1] == '0': continue
  26. if key[1] == 'a': continue
  27. leg.append(key)
  28. x = Xpr[key]
  29. y = Ypr[key]
  30. a.plot(x,y,color=colors[count])
  31. count += 1
  32. plt.savefig('ion density 5per Un.pdf',format='pdf')
  33.  
  34. plt.cla()
  35.  
  36. fig = plt.figure()
  37. ax = fig.add_axes([.1,.1,.8,.8]) # main axes
  38. colors=['red','blue']
  39. for key in Xpr: #Xpr holds my data
  40. #skipping over what I don't want to plot
  41. if not key[0] == '5': continue
  42. if key[1] == '0': continue
  43. if key[1] == 'a': continue
  44. x = Xpr[key]
  45. y = Ypr[key] #Ypr holds the Y axis and is created when Xpr is created
  46. ax.scatter(x,y,color=colors[count],marker='.',label=key)
  47. count += 1
  48.  
  49. ax.set_xlabel(r'$z/mu$')
  50. ax.set_ylabel(r'$rho(z)$')
  51. ax.set_xlim(0,10)
  52. leg = ax.legend()
  53.  
  54. #Now I wish to create the inset
  55. ax_inset=fig.add_axes([0.7,0.7,0.3,0.3])
  56. count =0
  57. for key in Xpr: #Xpr holds my data
  58. if not key[0] == '5': continue
  59. if key[1] == '0': continue
  60. if key[1] == 'a': continue
  61. x = Xpr[key]
  62. y = Ypr[key]
  63. ax_inset.plot(x,y,color=colors[count],label=key)
  64. count +=1
  65.  
  66. ax_inset.legend()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement