Guest User

http://chemistry.stackexchange.com/questions/9340/ Improved

a guest
Mar 21st, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /usr/bin/env python
  2.  
  3. import numpy as np
  4. import matplotlib.pyplot as plt
  5.  
  6. # Load Data
  7. affinity = np.loadtxt("affinity4.dat", usecols=(0,2))
  8. ionization = np.loadtxt("ionization3.dat", usecols=(0,2))
  9.  
  10. # Initialize empty lists
  11. finaff = []
  12. finion = []
  13. atomnum = []
  14.  
  15. # Find the common atoms in my data
  16. for i in range(affinity.shape[0]):
  17.     for j in range(ionization.shape[0]):
  18.         if affinity[i,0] == ionization[j,0] :
  19.             finaff += [affinity[i,1]]
  20.             finion += [ionization[i,1]]
  21.             atomnum += [affinity[i,0]]
  22.  
  23. cm = plt.get_cmap("Greys")
  24. normnum = atomnum
  25.  
  26.  
  27. fig = plt.figure(figsize=(8,6))
  28. scat = plt.scatter(finaff, finion, s=30, c=normnum, cmap=cm)
  29.  
  30. plt.xlabel("Electron Affinity [eV]", labelpad=10)
  31. plt.xlim(-0.08,4)
  32. plt.ylabel("1. Ionisation Energy [eV]", labelpad=10)
  33. cbar = plt.colorbar(scat)
  34. cbar.set_label("Atom Number", labelpad=10)
  35. plt.savefig("theplot.png", dpi=80)
Add Comment
Please, Sign In to add comment