File:Ghg pie chart.svg

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

Original file(SVG file, nominally 1,080 × 1,080 pixels, file size: 42 KB)

Captions

Captions

Pie chart of greenhouse gas emissions

Summary[edit]

Description
English: To create similar for another "Annex 1" country or year find the info in

http://di.unfccc.int/flex_annex1

Data is added mid-April for 2 years ago:be careful not to double count by overlapping categories,

and insert the figures into the code below.

(code could be improved to calculate the value for "Other" as currently it must be calculated manually)

Install Python and Matplot on your computer, amend the output file name for your country, run the program and upload to a new commons file.
Date
Source Own work
Author Chidgk1
SVG development
InfoField
 
The SVG code is valid.
 
This plot was created with Matplotlib.
Source code
InfoField

Python code

import matplotlib.pyplot as plt
import numpy as np

plt.rcdefaults()
plt.style.use('ggplot')
plt.rcParams['font.size'] = 25
plt.rcParams['patch.edgecolor'] = 'black'
plt.rcParams['lines.linewidth'] = 1
plt.figure(figsize=[12,12])

labels = ['Electricity from Coal', 'Road Transport', 'Manufacturing and Construction', 'Agriculture', 'Cement', 'Electricity from Gas', 'Home heating/cooking', 'Other']
values = [94,76,60,56,36,34,34,106]
colours = ['#754513','darkgrey','pink','green','lightgrey','khaki','yellow','white']
angle = 90

def func(pct, allvals):
    absolute = int(round(pct/100.*np.sum(allvals)))
    return "{:.2n}%\n({:d} mt)".format(pct, absolute)

patches, texts, autotexts = plt.pie(values, colors=colours, autopct=lambda pct: func(pct, values), pctdistance=0.6, labels=labels, labeldistance=1.1, shadow=False, startangle=angle)

for at in autotexts:
    at.set_fontsize(16.21)

plt.axis('equal')
plt.tight_layout()
plt.gca().set_position([0, 0, 1, 1])
plt.gcf().subplots_adjust(bottom=0.15)

plt.savefig('ghg_pie_chart.svg')

Licensing[edit]

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

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

Date/TimeThumbnailDimensionsUserComment
current10:16, 19 March 2019Thumbnail for version as of 10:16, 19 March 20191,080 × 1,080 (42 KB)Chidgk1 (talk | contribs)User created page with UploadWizard

There are no pages that use this file.

Metadata