plotter.py 850 B

1234567891011121314151617181920212223242526272829303132
  1. import pandas as pd
  2. import matplotlib.pyplot as plt
  3. ivef = pd.read_csv("../results-de/IVEF.csv")
  4. ivef["delta"] = (ivef["end"] - ivef["start"]) / 1000
  5. ivef["velocity"] = ivef["distance"] / ivef["delta"]
  6. sailing = ivef[ivef["location"].isnull()]
  7. mooring = ivef[~ivef["location"].isnull()]
  8. buckets1 = {}
  9. for vel in mooring["velocity"].to_numpy():
  10. if vel > 0:
  11. buckets1.setdefault(vel, 0)
  12. buckets1[vel] += 1
  13. buckets2 = {}
  14. for vel in sailing["velocity"].to_numpy():
  15. if vel > 0:
  16. buckets2.setdefault(vel, 0)
  17. buckets2[vel] += 1
  18. plt.xlabel("velocity (m/s)")
  19. plt.ylabel("number of vessels")
  20. plt.bar(buckets1.keys(), buckets1.values(), 0.01, label="in quay (mooring)")
  21. plt.bar(buckets2.keys(), buckets2.values(), 0.01, label="on canal/river (sailing)")
  22. plt.legend()
  23. plt.show()
  24. # velocity is most likely always 0 and 5 m/s = 18 km/h = 9.71 knots