File:U.S. Electricity Production 2015.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 714 × 361 pixels, file size: 45 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description
English: A graph showing U.S. energy production for the year 2015. Data from the U.S. Energy Information Administration.
Date
Source Own work
Author Douglas Perkins

The SVG file was produced using MatPlotLib with the following (also Public Domain) code.

#!/usr/bin/env python

from matplotlib import pyplot
from matplotlib import ticker
from matplotlib import numpy

# This generates a bar graph showing the U.S.'s electricity production in 2015.
#
# https://www.eia.gov/electricity/monthly/
# https://www.eia.gov/electricity/monthly/epm_table_grapher.cfm?t=epmt_1_01
#
# This file was written by Douglas Perkins.
# It is released under a Creative Commons Zero 1.0 license.
#
# https://creativecommons.org/publicdomain/zero/1.0/

# Renewable energy production in TWh.
petroleum_liquids = 17.456
petroleum_coke = 10.987
petroleum = petroleum_liquids + petroleum_coke

# Energy production in TWh.
data = [
("Coal", 1356.057),
("Gas", 1335.068),
("Nuclear", 797.178),
("Renewable\n(non-solar)", 271.885),
("Hydro", 251.168),
("Solar", 37.371),
("Oil", petroleum),
]

sources = [d[0] for d in data]
amounts = [d[1] for d in data]

# A formatter to display comma-separated numbers on the y axis.
def comma_func(x, pos):
	s = '{:0,d}'.format(int(x))
	return s

comma_format = ticker.FuncFormatter(comma_func)

# Make a bar graph.
x = numpy.arange(len(sources)) + 0.25
width = 0.5
pyplot.figure(num=1, figsize=(9,3))
pyplot.title("U.S. Electricity Production 2015")
pyplot.bar(x, amounts, width, color='gold')
pyplot.xlabel('Source')
pyplot.ylabel('Electricity (TWh)')
yticks = pyplot.xticks(x + width/2.0, sources)
pyplot.xticks(rotation='vertical')
pyplot.subplot(111).yaxis.set_major_formatter(comma_format)
pyplot.subplot(111).grid(b=True, axis='y')
pyplot.savefig('Chapter 7.US Electricity Production 2015.svg', format='svg', bbox_inches='tight')

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current12:44, 23 November 2016Thumbnail for version as of 12:44, 23 November 2016714 × 361 (45 KB)Douglaspperkins (talk | contribs)User created page with UploadWizard

There are no pages that use this file.

Metadata