Skip to content

Commit

Permalink
Update OT_regressions.py
Browse files Browse the repository at this point in the history
  • Loading branch information
echedey-ls committed Nov 5, 2022
1 parent d7cf8b7 commit 104adbf
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions Oficina Técnica/OT_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ def main():
# Meses menor demanda
x = np.arange(0,6)
y = y_ene_jun

# Barras de demandas
ax.bar(x_months[:6], y, edgecolor="k",
label='Demanda: meses de menor demanda')
# Regresión
regLine = linregress(x, y)
regLx = [min(x), max(x)]
regLy = [regLine.slope * regLx[0] + regLine.intercept, regLine.slope * regLx[-1] + regLine.intercept]
Expand All @@ -52,13 +53,24 @@ def main():
linewidth = '5',
label= 'Regresión lineal: meses de menor demanda'
)
# Previsiones: Baja demanda
regLy = [regLine.slope * 6 + regLine.intercept, regLine.slope * 11 + regLine.intercept]
plt.plot(
regLx,
regLy,
color= 'indigo',
linestyle= 'dashed',
linewidth = '5',
label= 'Extrapolación siguiente año: alta demanda'
)

# Meses de mayor demanda
x = np.arange(6,12)
y = y_jul_dic

# Barras de demanda
ax.bar(x_months[6:], y, edgecolor="k",
label='Demanda: meses de mayor demanda')
# Regresión
regLine = linregress(x, y)
regLx = [min(x), max(x)]
regLy = [regLine.slope * regLx[0] + regLine.intercept, regLine.slope * regLx[-1] + regLine.intercept]
Expand All @@ -71,6 +83,17 @@ def main():
linewidth = '5',
label= 'Regresión lineal: meses de mayor demanda'
)
# Previsiones: Alta demanda
regLy = [regLine.slope * 12 + regLine.intercept, regLine.slope * 17 + regLine.intercept]
plt.plot(
regLx,
regLy,
color= 'deeppink',
linestyle= 'dashed',
linewidth = '5',
label= 'Extrapolación siguiente año: alta demanda'
)


ax.set_xticks(np.arange(0,12))
ax.set_xticklabels(x_months)
Expand Down

0 comments on commit 104adbf

Please sign in to comment.