import matplotlib.pyplot as plt

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

# Datos de energía eléctrica y térmica
electric_energy = [242.4169, 239.3776, 348.1548, 285.192, 343.5978, 333.294, 387.9278, 242.8044, 251.964, 
                   245.6564, 291.456, 262.8087]
thermal_energy = [645.513, 641.256, 934.464, 777.96, 928.915, 907.53, 1036.113, 655.836, 671.4, 658.13, 
                  769.89, 694.276]

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

# Graficar energía eléctrica
ax.plot(months, electric_energy, marker='o', color='blue', linestyle='-', linewidth=2, label='Energía eléctrica')

# Graficar energía térmica
ax.plot(months, thermal_energy, marker='s', color='red', linestyle='-', linewidth=2, label='Energía térmica')

# Configuración de etiquetas y título
ax.set_ylabel('Energía (kWh)', 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(200, 1200)

# 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: