columns visualization with MATPLOTLIB in Python


SUBMITTED BY: ne0n

DATE: March 9, 2023, 7:18 p.m.

FORMAT: Python 3.0 Traceback

SIZE: 1.3 kB

HITS: 469

  1. titanic.plot(subplots = True, figsize = (15,12), sharex = False, sharey = False)
  2. plt.show()
  3. ##################################################
  4. xticks = [x for x in range(0,901, 50)]
  5. xticks
  6. yticks = [y for y in range(0, 81, 5)]
  7. yticks
  8. plt.style.available
  9. plt.style.use("classic")
  10. titanic.age.plot(figsize = (12,8), fontsize= 13, c = "r", linestyle = "-",
  11. xlim = (0,900), ylim = (0,80), xticks = xticks, yticks = yticks, rot = 45)
  12. plt.title("Titanic - Ages", fontsize = 15)
  13. plt.legend(loc = 3, fontsize = 15)
  14. plt.xlabel("Passenger No", fontsize = 13)
  15. plt.ylabel("Age", fontsize = 13)
  16. plt.grid()
  17. plt.show()
  18. ######################################################
  19. # Histogram
  20. titanic.age.plot(kind = "hist", figsize = (12,8), fontsize = 15, bins = 80, density = True)
  21. plt.show()
  22. ######################################################
  23. # Bar chart
  24. summer_2012.Medal.plot(kind = "bar", figsize = (12,8), fontsize = 12)
  25. plt.show() # all countries with their medals
  26. summer_2012.Medal.plot(kind = "barh", figsize = (12,8), fontsize = 12)
  27. plt.show()
  28. ######################################################
  29. # Pie chart
  30. summer_2012.Medal.plot(kind = "pie", figsize = (12,8), fontsize = 12)
  31. plt.show()

comments powered by Disqus