High-Level Trends in Renewable and Fossil Fuel Energy: Part 3

In part three of this series, we are going to look at trends of specific renewable energy types such as wind, solar, geothermal, and hydroelectric. While renewables are not a new concept, how to scale the technology to capture the energy generated by renewable sources is. For this analysis, we will use visualizations just like in the last part of the series but this time we will use filled area plots to show the proportion of renewable energy each source contributed to the total over the last twenty years for both China and the U.S.

Stacked area charts in Plotly are great visualizations to view changes in in the contribution of a certain variable to the whole. In this case we are looking at the contribution of different renewable energy types(solar,wind,tide,geothermal, and hydroelectric) to the total renewable energy generated from the year 2000 to current. We will focus on China and the U.S. as both the largest polluters but also as the two countries that can lead the way in developing renewable energy at scale.

You can make stacked charts in Plotly using Plotly Express or Plotly Graph Objects. In this blog we’ll learn how to make them and then see what we can deduce from the visuals. Let’s get started!

The values used to represent the fraction of total renewable energy were calculated using column arithmetic (electricity generated from renewable type/total electricity generated by renewables).

# importing libraries 
import pandas as pd
import requests
import matplotlib.pyplot as plt
import numpy as np
from datetime import date
import plotly.express as px
import matplotlib.ticker as ticker
from plotly import graph_objects as go
from fbprophet import Prophet
from fbprophet.plot import add_changepoints_to_plot
from sklearn.metrics import mean_squared_error, mean_absolute_error
from IPython.core.display import display, HTML
from IPython.display import IFrame
import warnings
warnings.filterwarnings("ignore")
x=['2000',
'2001',
'2002',
'2003',
'2004',
'2005',
'2006',
'2007',
'2008',
'2009',
'2010',
'2011',
'2012',
'2013',
'2014',
'2015',
'2016',
'2017',
'2018',
'2019']
fig = go.Figure()fig.add_trace(go.Scatter(
x=x, y=['0.001671001',
'0.00225623',
'0.00199702',
'0.001945487',
'0.002197627',
'0.002410707',
'0.002526976',
'0.003607979',
'0.005081711',
'0.005611876',
'0.008184602',
'0.010620854',
'0.020364335',
'0.031569333',
'0.051349303',
'0.068189415',
'0.085460267',
'0.106785201',
'0.12459771',
'0.137579911'],

mode='lines',
name = 'solar,tide, wave, fuel cell',
line=dict(width=0.5, color='Crimson'),
stackgroup='one',
groupnorm='percent' # sets the normalization for the sum of the stackgroup
))
fig.add_trace(go.Scatter(
x=x, y=['0.370512306',
'0.390381614',
'0.415014182',
'0.41714528',
'0.435144263',
'0.460463213',
'0.493874729',
'0.536898301',
'0.601065078',
'0.587840781',
'0.634177512',
'0.646988238',
'0.676837043',
'0.724478983',
'0.728991555',
'0.733488661',
'0.746385699',
'0.740161338',
'0.72375927',
'0.762550013'],

mode='lines',
name = 'hydro electricity',
line=dict(width=0.5, color='DarkCyan'),
stackgroup='one'
))
fig.add_trace(go.Scatter(
x=x, y=['0.015477378',
'0.022475029',
'0.028993575',
'0.030275465',
'0.038649793',
'0.048030777',
'0.066598132',
'0.094206252',
'0.140560687',
'0.171357703',
'0.213834719',
'0.226187091',
'0.273699941',
'0.308646662',
'0.32249938',
'0.33318634',
'0.353564522',
'0.351407437',
'0.363882501',
'0.380820094'],

mode='lines',
name = 'wind',
line=dict(width=0.5, color='DarkBlue'),
stackgroup='one'
))
fig.add_trace(go.Scatter(
x=x, y=['0.038997846',
'0.045836869',
'0.040577894',
'0.039034782',
'0.040473105',
'0.039620111',
'0.036488718',
'0.040026702',
'0.037677032',
'0.03480828',
'0.034382662',
'0.028826718',
'0.030247007',
'0.029008627',
'0.028186924',
'0.02780809',
'0.02465034',
'0.022008366',
'0.021308596',
'0.019914398'],

mode='lines',
name = 'geothermal',
line =dict(width=0.5, color='DarkOrange'),
stackgroup='one'
))
fig.update_layout(
showlegend=True,
xaxis_type='category',
title='U.S. Renewable Energy Sources',
yaxis=dict(
type='linear',
range=[1, 100],
ticksuffix='%'))
fig.show()

And the resulting graph looks like this…

And for China…

Ok we have our graphs! again, I showed the code for the U.S. graph but for the graph representing China’s renewable energy sources all you have to do is replace the numbers in each category.

Starting at a high level, from the U.S. graph we see that renewables have been around longer than the last few years in which they have really picked up in popularity due to the acceptance of climate change and the introduction of policies that promote green energy. Hydroelectric power is the dominant source of renewable energy, but as we can see from the graph above, in recent times wind and solar have started taking a larger piece of the pie. This is partly due to the negative impact that dams have on a river’s ecosystem. By changing the natural flow of rivers, both the physical attributes of the river change(higher flow rate, more erosion) as well as biological behavior such as migratory patterns of fish that effect their ability to reproduce. So, while hydroelectric power is considered renwable it is not totally green and may be the reason for it’s slow decline over recent years. Solar and wind power however are on the ascendency. Although wind power does have some ecological impact, what makes this power source desirable is that wind is cost effective and uses a fraction of the land they are built on. However, recent projects seeking to build wind farms offshore add even more value since this would mean not using land that can be used for other needs such as agriculture. Finally, let’s talk about geothermal which is the process of creating energy from earth’s natural heat that’s generated in the core and eminates to the surface. From the graphs above we see geothermal is declining in the U.S. and at such a small amount (~2%) that it doesn’t seem to appear on the graph for China. This is partly due to the fact that geothermal energy is expensive. As I mentioned, geothermal is tapping into heat generated from the core and in order to reach temperatures high enough to produce energy, wells must be drilled and drilling is very expensive. However, the amount of energy locked inside our planet is immense and has great potential, as the demand for renewable energy increases, technologies capable of making geothermal more economic may also appear that change the current outlook for geothermal.

At this point we have talked a lot of about climate change and renewables. But this blog series is also about how these changes in demand for renewable energy sources will effect oil demand. In the next two blogs we’ll look at historical oil prices and attempt to forecast prices for the next two years in an attempt to identify any trends as a result of the increase in renewable energy.