This is comment for paste
tom_and_jerry_game
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # How to print the pathway for tom and jerry
- import pandas as pd
- import matplotlib.pyplot as plt
- jerry_path = r"D:\other\tom_and_jerry\tom_and_jerry\pathway.csv"
- if __name__ == '__main__':
- df =pd.read_csv(jerry_path)
- x_max = df[['cat_x', 'mouse_x']].max(axis=0).max()
- y_max = df[['cat_y', 'mouse_y']].max(axis=0).max()
- ax = df.plot(x="cat_x", y="cat_y", color='C3', label='Tom')
- df.plot(x="mouse_x", y="mouse_y", color='C0', label='Jerry', ax=ax)
- plt.xlabel('X-coordinate')
- plt.ylabel('Y-coordinate')
- plt.xlim([0, 1.2 * x_max])
- plt.ylim([0, 1.2 * y_max])
- plt.grid(True)
- plt.title('Pathway of Tom & Jerry')
- plt.show()
- # plt.savefig("some_title.png")
Advertisement
Add Comment
Please, Sign In to add comment