Advertisement
nanokatka

plot 2D graph

Feb 12th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. filename=input("name of the file:")
  5. data = np.genfromtxt(filename, unpack=True, delimiter='\t')
  6. dataname=filename[:-4]
  7.  
  8. x=data[0,2:]
  9. y=data[1:,0]
  10. xmin=x[0]
  11. xmax=x[-1]
  12. ymin=y[0]
  13. ymax=y[-1]
  14. values = data[1:,2:]
  15. values2=np.rot90(values.T)
  16. values3=(values2-np.min(values2))/(np.max(values2)-np.min(values2))
  17.  
  18. fig = plt.figure(figsize=(8,8))
  19. ax = fig.gca()
  20. ax.set_xlim(xmin, xmax)
  21. ax.set_ylim(ymin, ymax)
  22. ax.imshow(values3, cmap='jet', extent=[xmin, xmax, ymin, ymax],vmin=0,vmax=0.6)
  23. ax.set_xlabel('emission wavelength [nm]')
  24. ax.set_ylabel('excitation wavelength [nm]')
  25. plt.title('PLE map for ' + dataname)
  26. plt.savefig(dataname+'.png',dpi=150)
  27. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement