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
fig = go.Figure()fig.add_trace(go.Scatter(
x=x, y=['0.001671001',

name = 'solar,tide, wave, fuel cell',
line=dict(width=0.5, color='Crimson'),
groupnorm='percent' # sets the normalization for the sum of the stackgroup
x=x, y=['0.370512306',

name = 'hydro electricity',
line=dict(width=0.5, color='DarkCyan'),
x=x, y=['0.015477378',

name = 'wind',
line=dict(width=0.5, color='DarkBlue'),
x=x, y=['0.038997846',

name = 'geothermal',
line =dict(width=0.5, color='DarkOrange'),
title='U.S. Renewable Energy Sources',
range=[1, 100],

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.