Guest User

Stacked bar

a guest
Oct 2nd, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.49 KB | None | 0 0
  1. plt.figure(figsize=(10, 8))
  2. plt.style.use('bmh')
  3. SMALL_SIZE = 12
  4. MEDIUM_SIZE = 16
  5. BIGGER_SIZE = 18
  6.  
  7. plt.rc('font', size=SMALL_SIZE)          # controls default text sizes
  8. plt.rc('axes', titlesize=SMALL_SIZE)     # fontsize of the axes title
  9. plt.rc('axes', labelsize=MEDIUM_SIZE)    # fontsize of the x and y labels
  10. plt.rc('xtick', labelsize=SMALL_SIZE)    # fontsize of the tick labels
  11. plt.rc('ytick', labelsize=SMALL_SIZE)    # fontsize of the tick labels
  12. plt.rc('legend', fontsize=SMALL_SIZE)    # legend fontsize
  13. plt.rc('figure', titlesize=BIGGER_SIZE)  # fontsize of the figure title
  14.  
  15. years1 = [str(2009+i) for i in range(1, 8)]
  16. years2 = [str(2016+i) for i in range(1, 8)]
  17. ind1 = [year for year in years1]
  18. ind2 = [year for year in years2]
  19. data11 = np.array([92767,95443,98028,101099,110768,114209,117456])
  20. data12 = np.array([122577,125106,132925,142123,144391,150075,161593])
  21. data21 = np.array([2676,2585,3070,9669,3441,3248,5119])
  22. data22 = np.array([2348,7819,9198,2268,5684,11518,12500])
  23.  
  24. plt.bar(ind1, data21, width=0.6, label='Acréscimo verificado', bottom=data11, color='#9FC1D6')
  25. plt.bar(ind1, data11, width=0.6, color='#5F99BC')
  26. plt.bar(ind2, data22, width=0.6, label='Acréscimo previsto', bottom=data12, color='#5FBC81')
  27. plt.bar(ind2, data12, width=0.6, color='#5F99BC')
  28.  
  29. #plt.xticks(ind, years)
  30. plt.ylabel("Linhas de transmissão (km)")
  31. plt.legend(loc="upper left")
  32. plt.title("Evolução do Sistema Interligado Nacional (SIN)", fontdict={'fontsize':BIGGER_SIZE})
  33. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment