azakharov93
Dec 3rd, 2022 (edited)
53
0
Never
This is comment for paste tom_and_jerry_game
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # How to print the pathway for tom and jerry
  2. import pandas as pd
  3. import matplotlib.pyplot as plt
  4.  
  5. jerry_path = r"D:\other\tom_and_jerry\tom_and_jerry\pathway.csv"
  6.  
  7. if __name__ == '__main__':
  8.     df =pd.read_csv(jerry_path)
  9.  
  10.     x_max = df[['cat_x', 'mouse_x']].max(axis=0).max()
  11.     y_max = df[['cat_y', 'mouse_y']].max(axis=0).max()
  12.  
  13.     ax = df.plot(x="cat_x", y="cat_y", color='C3', label='Tom')
  14.     df.plot(x="mouse_x", y="mouse_y", color='C0', label='Jerry', ax=ax)
  15.  
  16.     plt.xlabel('X-coordinate')
  17.     plt.ylabel('Y-coordinate')
  18.     plt.xlim([0, 1.2 * x_max])
  19.     plt.ylim([0, 1.2 * y_max])
  20.     plt.grid(True)
  21.     plt.title('Pathway of Tom & Jerry')
  22.     plt.show()
  23.     # plt.savefig("some_title.png")
Advertisement
Add Comment
Please, Sign In to add comment