Advertisement
elena1234

how to create line plot in Python

Jan 3rd, 2023 (edited)
1,129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | Source Code | 0 0
  1. import matplotlib.pyplot as plt
  2.  
  3. plt.style.available
  4. plt.style.use("seaborn) # how to choose the style
  5.  
  6. #############################################################
  7. titanic.plot(subplots = True, figsize=(15,12), sharex= False)
  8. plt.show()
  9.  
  10.  
  11. #########################################################################3
  12. xticks = [x for x in range(0,901,50) # from 0 to 900 between 50
  13. yticks = [y for y in range(0,81,5)] # from 0 to 81 between 5
  14.  
  15. titanic.age.plot(figsize=(12,10),fontsize=13,c='r',linestyle= '-',xlim=(0,900),ylim=(0,80),xtics=xtics, yticks=yticks, rot=45))
  16. plt.title("Titanic ages")
  17. plt.legend(loc = 3, fontsize = 15)
  18. plt.grid()
  19. plt.show()
  20.  
  21. ########################################################################
  22. cars.plot(kind = 'line',subplots = True, figsize=(15,12), sharex= False, xlim = (0,350))
  23. plt.show()
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement