Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. date = ["2017-05-20 20:49","2017-05-20 20:50","2017-05-20 20:51","2017-05-20 20:52","2017-05-20 20:53","2017-05-20 20:54","2017-05-20 20:55",
  2. "2017-05-20 20:56","2017-05-20 20:57","2017-05-20 20:58","2017-05-20 20:59","2017-05-20 21:00","2017-05-20 21:01","2017-05-20 21:02",
  3. "2017-05-20 21:03","2017-05-20 21:04","2017-05-20 21:05","2017-05-20 21:06","2017-05-20 21:07","2017-05-20 21:08","2017-05-20 21:09",
  4. "2017-05-20 21:10","2017-05-20 21:11","2017-05-20 21:12","2017-05-20 21:13","2017-05-20 21:14","2017-05-20 21:15","2017-05-20 21:16",
  5. "2017-05-20 21:17","2017-05-20 21:18","2017-05-20 21:19","2017-05-20 21:20","2017-05-20 21:21","2017-05-20 21:22","2017-05-20 21:23"]
  6. date = pd.to_datetime(date)
  7. mp_10 = [502,507,514,521,528,533,539,544,548,551,553,554,555,555,555,554,553,552,551,551,550,548,547,545,543,541,538,534,530,525,520,515,510,506,501]
  8. equipos = [11,11,11,16,18,19,21,24,24,25,25,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1] #35
  9.  
  10. df = pd.DataFrame({"fecha": date, "mp-10": mp_10, "totalEquipos": equipos})
  11.  
  12.  
  13. ## PLOT
  14. sns.set(style='whitegrid', palette="deep", font_scale=1.1, rc={"figure.figsize": [8, 5]})
  15. myFmt = mdates.DateFormatter("%H:%M")
  16. fig, ax = plt.subplots(figsize=(15,8))
  17. #PLot Line
  18. plot_line = ax.plot(df.fecha, df['mp-10'], color='teal', marker='o')
  19. ax.set_xlim(["2017-05-20 20:46", "2017-05-20 21:25"])
  20. ax.set_xticklabels(df.fecha)
  21. ax.set_ylim([0,700])
  22. ax.set_xlabel("Hora: (20:49 - 21:23)", fontsize= 18)
  23. ax.set_ylabel("MP-10 (ug/m3N)", color="teal", fontsize = 18)
  24. ax.set_title("Peak 3 - MP-10 - Otoño - 20/05/2017", fontsize = 20)
  25. ax.tick_params(axis='y', labelcolor="teal")
  26. #Plot Bar
  27. ax2 = ax.twinx()
  28. plot_bar= ax2.bar(x = 'fecha', height = 'totalEquipos', data = df, color= 'purple', label='Total equipos', align = 'edge', linewidth= 4)
  29. ax2.tick_params(axis='y', labelcolor= 'purple')
  30. ax2.set_ylabel("Total equipos", color = 'purple', fontsize = 18)
  31. ax2.set_ylim([0,40])
  32. ax2.tick_params(axis='y')
  33. #Legends
  34. lns = plot_line + [plot_bar]
  35. labs = [l.get_label() for l in lns]
  36. ax.legend(lns, labs, loc='center', fontsize=15)
  37. fig.tight_layout()
  38. ax.xaxis.set_major_formatter(myFmt);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement