import matplotlib.pyplot as plt

# Meses en inglés
months = ['Ene', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 
          'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic']

# Datos de potencia eléctrica y térmica
electric_power = [0.7109, 0.7772, 0.9359, 0.7922, 0.8526, 0.8546, 0.9626, 0.6527, 0.6999, 0.7204, 0.8832, 0.7707]
thermal_power = [1.893, 2.082, 2.512, 2.161, 2.305, 2.327, 2.571, 1.763, 1.865, 1.93, 2.333, 2.036]

# Configuración del tamaño de la figura
fig, ax = plt.subplots(figsize=(12, 8))

# Graficar potencia eléctrica
ax.plot(months, electric_power, marker='o', color='blue', linestyle='-', linewidth=2, label='Potencia eléctrica')

# Graficar potencia térmica
ax.plot(months, thermal_power, marker='s', color='red', linestyle='-', linewidth=2, label='Potencia térmica')

# Configuración de etiquetas y título
ax.set_ylabel('Potencia (kW)', fontsize=20)
ax.set_xlabel('Meses', fontsize=20)
ax.tick_params(axis='both', labelsize=20)

# Título del gráfico
ax.set_title('', fontsize=22)

# Leyenda
ax.legend(loc='upper left', fontsize=20)

# Acentuar el marco del gráfico
for spine in ax.spines.values():
    spine.set_edgecolor('black')
    spine.set_linewidth(2)

# Ajuste de límites del eje Y
ax.set_ylim(0, 3.5)

# Ajuste de diseño
fig.tight_layout()

# Mostrar el gráfico
plt.show()

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: