import pandas as pd
import matplotlib.pyplot as plt
from dateutil.parser import parse
13 Intro rápida a Matplotlib
= '../../data/Temixco_2018_10Min.csv'
f = pd.read_csv(f,index_col=0,parse_dates=True)
tmx tmx.columns
Index(['Ib', 'Ig', 'To', 'RH', 'WS', 'WD', 'P'], dtype='object')
= plt.subplots(figsize=(12,4),sharex=True)
fig, ax
# fecha1 = parse('2018-03-10')
# fecha2 = fecha1 + pd.Timedelta('3D')
'Ig'],label='Ig')
ax.plot(tmx['Ib'],label='Ib')
ax.plot(tmx[
ax.legend()# ax.set_xlim(fecha1,fecha2)
= '../../data/personas_cargas.csv'
f = pd.read_csv(f,index_col=0,parse_dates=True)
cargas = cargas.columns
columnas columnas
Index(['BATH_2_LIGHT:Lights Electricity Rate (W)',
'BATH_LIGHT:Lights Electricity Rate (W)',
'COCINA_ESTUFA_EQUIPMENT:Electric Equipment Electricity Rate (W)',
'COCINA_REFR_EQUIPMENT:Electric Equipment Electricity Rate (W)',
'ESTANCIA_COCINA_LIGHT:Lights Electricity Rate (W)',
'ESTANCIA_TV_EQUIPMENT:Electric Equipment Electricity Rate (W)',
'R_1_LIGHT:Lights Electricity Rate (W)',
'R_2_LIGHT:Lights Electricity Rate (W)',
'R_3_LIGHT:Lights Electricity Rate (W)',
'STAND_BY_EQUIPMENT:Electric Equipment Electricity Rate (W)',
'B1:Space People Occupant Count ()',
'B2:Space People Occupant Count ()',
'COCINA:Space People Occupant Count ()',
'R1:Space People Occupant Count ()',
'R2:Space People Occupant Count ()',
'R3:Space People Occupant Count ()'],
dtype='object')
= [columna for columna in columnas if 'People' in columna]
etiquetas etiquetas
['B1:Space People Occupant Count ()',
'B2:Space People Occupant Count ()',
'COCINA:Space People Occupant Count ()',
'R1:Space People Occupant Count ()',
'R2:Space People Occupant Count ()',
'R3:Space People Occupant Count ()']
= plt.subplots(figsize=(12,4))
fig, ax
for columna in columnas if 'People' in columna],labels= etiquetas)
ax.stackplot(cargas.index,[cargas[columna]
; ax.legend()