Guest User

Untitled

a guest
Nov 13th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. def read_two_column_file(file_name):
  2. with open(file_name, 'r') as f_input:
  3. csv_input = csv.reader(f_input, delimiter=' ', skipinitialspace=True, )
  4. long = []
  5. lat = []
  6. for col in csv_input:
  7. x = float(col[0]) # converting to float
  8. y = float(col[1])
  9. long.append(x)
  10. lat.append(y)
  11.  
  12. return long, lat
  13.  
  14.  
  15. def display_points(long, lat):
  16. plt.figure()
  17. plt.gca().set_aspect('equal', adjustable='box')
  18. plt.ylabel('latitude')
  19. plt.xlabel('longitude')
  20. plt.title('longitude vs latitude')
  21. plt.scatter(lat, long)
  22. plt.orientation = u'vertical'
  23. plt.grid('True')
  24. plt.show()
  25.  
  26. 35.905333, 14.471970
  27. 35.896389, 14.477780
  28. 35.901281, 14.518173
  29. 35.860491, 14.572245
  30. 35.807607, 14.535320
  31. 35.832267, 14.455894
  32. 35.882414, 14.373217
  33. 35.983794, 14.336096
  34. 35.974463, 14.351006
  35. 35.930951, 14.401137
  36.  
  37. [2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2]
  38.  
  39. long = np.array(long)
  40. lat = np.array(lat)
  41.  
  42. plt.plot(long[path], lat[path])
Add Comment
Please, Sign In to add comment