No topics yet. Start the conversation.

Summary

User supplied summary for the plot

World Energy Consumption by Source from OWID 2025

Description

The below description is supplied in free-text by the user
import inspect, sys
from novem import Plot
from novem.colors import StaticColor as SC, DynamicColor as DC
from novem.table import Selector as S


# Download open data from Ower World in Data 
url = "https://raw.githubusercontent.com/owid/energy-data/master/owid-energy-data.csv"
df = pd.read_csv(url)

# GLobal data on consumption in TWh per year 
world = df[(df["country"] == "World") & (df["year"] >= 1980)][[
    "year",
    "coal_consumption",
    "oil_consumption",
    "gas_consumption",
    "nuclear_consumption",
    "renewables_consumption"
]]
# Rename columns for readability
world = world.rename(columns={
    "coal_consumption": "Coal",
    "oil_consumption": "Oil",
    "gas_consumption": "Gas",
    "nuclear_consumption": "Nuclear",
    "renewables_consumption": "Renewables"
})

# Divide by 1000 to get a more readable number (1000 TWh)
for col in world.columns:
    if col != "year":
        world[col] = world[col]/1000


world.set_index("year", inplace=True)   


# Novem plot 
plt = Plot('world_energy_consumption')
plt.data = world
plt.title = 'World Energy Consumption by Source (´000 TWh)'
plt.type = 'sbar'
plt.shared += 'public'
print(plt.url)
plt.caption = """Global energy consumption per year. Source: Our World in Data (2025)"""
plt.description = '```python' + ' ' + inspect.getsource(sys.modules[__name__]) + '```' # Include this python script in Description
plt.name = "World Energy Consumption"
plt.summary = "World Energy Consumption by Source from OWID 2025"