Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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",
- "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",
- "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",
- "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",
- "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"]
- date = pd.to_datetime(date)
- 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]
- 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
- df = pd.DataFrame({"fecha": date, "mp-10": mp_10, "totalEquipos": equipos})
- ## PLOT
- sns.set(style='whitegrid', palette="deep", font_scale=1.1, rc={"figure.figsize": [8, 5]})
- myFmt = mdates.DateFormatter("%H:%M")
- fig, ax = plt.subplots(figsize=(15,8))
- #PLot Line
- plot_line = ax.plot(df.fecha, df['mp-10'], color='teal', marker='o')
- ax.set_xlim(["2017-05-20 20:46", "2017-05-20 21:25"])
- ax.set_xticklabels(df.fecha)
- ax.set_ylim([0,700])
- ax.set_xlabel("Hora: (20:49 - 21:23)", fontsize= 18)
- ax.set_ylabel("MP-10 (ug/m3N)", color="teal", fontsize = 18)
- ax.set_title("Peak 3 - MP-10 - Otoño - 20/05/2017", fontsize = 20)
- ax.tick_params(axis='y', labelcolor="teal")
- #Plot Bar
- ax2 = ax.twinx()
- plot_bar= ax2.bar(x = 'fecha', height = 'totalEquipos', data = df, color= 'purple', label='Total equipos', align = 'edge', linewidth= 4)
- ax2.tick_params(axis='y', labelcolor= 'purple')
- ax2.set_ylabel("Total equipos", color = 'purple', fontsize = 18)
- ax2.set_ylim([0,40])
- ax2.tick_params(axis='y')
- #Legends
- lns = plot_line + [plot_bar]
- labs = [l.get_label() for l in lns]
- ax.legend(lns, labs, loc='center', fontsize=15)
- fig.tight_layout()
- ax.xaxis.set_major_formatter(myFmt);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement