Datei:Polulation Pyramid Germany 2010.svg

Aus RSG-Wiki
Wechseln zu: Navigation, Suche
Polulation_Pyramid_Germany_2010.svg(SVG-Datei, Basisgröße: 234 × 325 Pixel, Dateigröße: 39 KB)

Diese Datei stammt aus Wikimedia Commons und kann von anderen Projekten verwendet werden. Die Beschreibung von deren Dateibeschreibungsseite wird unten angezeigt.

Beschreibung

Beschreibung Polulation Pyramid Germany 2010
Datum
Quelle Eigenes Werk
Urheber Lennart Kudling
SVG‑Erstellung
InfoField
 
Der SVG-Code ist valide.
 
Diese Vektorgrafik wurde mit Python erstellt.
 
The file size of this SVG image may be irrationally large because its text has been converted to paths inhibiting translations.
Quelltext
InfoField

Python code

#-*- coding: iso-8859-1 -*

# This Python program prints a LaTeX/TikZ document to stdout.
# Pipe the output of this script to a "foo.tex" file and afterwards call "pdflatex foo"
# The resulting "foo.pdf" file can be converted to SVG using
# http://www.tlhiv.org/MetaPost/tools/mptosvg/

# Data source:
# http://www.destatis.de/bevoelkerungspyramide/12kvb1w1.js
#
# 1950 + 60 = 2010
# popMale = popData[0][age][60]
# popFemale = popData[1][age][60]

data = \
    [
      (0, 341, 323)
    , (1, 350, 333)
    , (2, 353, 335)
    , (3, 348, 329)
    , (4, 353, 335)
    , (5, 363, 345)
    , (6, 364, 345)
    , (7, 370, 351)
    , (8, 379, 359)
    , (9, 395, 377)
    , (10, 398, 376)
    , (11, 406, 385)
    , (12, 419, 398)
    , (13, 412, 390)
    , (14, 399, 379)
    , (15, 406, 385)
    , (16, 422, 401)
    , (17, 433, 413)
    , (18, 451, 429)
    , (19, 498, 473)
    , (20, 497, 474)
    , (21, 515, 492)
    , (22, 508, 486)
    , (23, 502, 485)
    , (24, 490, 475)
    , (25, 490, 475)
    , (26, 496, 482)
    , (27, 511, 497)
    , (28, 509, 498)
    , (29, 515, 503)
    , (30, 490, 479)
    , (31, 484, 473)
    , (32, 481, 469)
    , (33, 474, 463)
    , (34, 464, 451)
    , (35, 470, 460)
    , (36, 476, 465)
    , (37, 524, 509)
    , (38, 581, 561)
    , (39, 609, 586)
    , (40, 657, 628)
    , (41, 689, 658)
    , (42, 706, 676)
    , (43, 726, 694)
    , (44, 734, 696)
    , (45, 745, 710)
    , (46, 740, 707)
    , (47, 714, 687)
    , (48, 700, 681)
    , (49, 680, 662)
    , (50, 658, 641)
    , (51, 624, 608)
    , (52, 610, 597)
    , (53, 592, 584)
    , (54, 572, 569)
    , (55, 558, 564)
    , (56, 538, 548)
    , (57, 537, 550)
    , (58, 525, 539)
    , (59, 527, 542)
    , (60, 509, 520)
    , (61, 467, 476)
    , (62, 436, 450)
    , (63, 379, 393)
    , (64, 331, 351)
    , (65, 438, 464)
    , (66, 443, 471)
    , (67, 427, 458)
    , (68, 510, 556)
    , (69, 529, 587)
    , (70, 511, 576)
    , (71, 468, 535)
    , (72, 427, 498)
    , (73, 403, 483)
    , (74, 377, 461)
    , (75, 338, 424)
    , (76, 262, 338)
    , (77, 248, 332)
    , (78, 240, 334)
    , (79, 238, 344)
    , (80, 216, 326)
    , (81, 199, 313)
    , (82, 166, 288)
    , (83, 142, 277)
    , (84, 122, 264)
    , (85, 95, 236)
    , (86, 80, 212)
    , (87, 73, 197)
    , (88, 63, 183)
    , (89, 51, 154)
    , (90, 31, 99)
    , (91, 16, 54)
    , (92, 12, 41)
    , (93, 10, 36)
    , (94, 10, 34)
    , (95, 9, 33)
    , (96, 6, 26)
    , (97, 4, 18)
    , (98, 2, 12)
    , (99, 1, 8)
    ]

# Find the maximums.
maxMale = 0
maxFemale = 0

for (_, popMale, popFemale) in data:

    if popMale > maxMale:
        maxMale = popMale
    if popFemale > maxFemale:
        maxFemale = popFemale

# Header
print \
    '\documentclass[a4paper,10pt]{article}\n' \
    '%\n' \
    '\usepackage{ngerman}\n' \
    '\usepackage{tikz}\n' \
    '\usepackage[active,tightpage]{preview}\n' \
    '\PreviewEnvironment{tikzpicture}\n' \
    '%\n' \
    '\usepackage[latin1]{inputenc}\n' \
    '\usepackage[T1]{fontenc}\n' \
    '\usepackage{fourier}\n' \
    '%\n' \
    '\\begin{document}\n' \
    '%\n' \
    '\\begin{tikzpicture}\n' \
    '%\n'

def yLabel(y, scale):
    realY = y * scale
    
    print '\\node at (%f,%f) {%i};' % (0.0, realY, y)

def yLines(offset, xScale, yScale, printMale, horizontalLines):
    if printMale:
        maxPop = maxMale
    else:
        maxPop = maxFemale
    
    for age in horizontalLines:
        
        x = maxPop * xScale + offset
        y = yScale * age
        
        print '\draw[color=white] (%f,%f) -- (%f,%f);' % (offset, y, x, y)

def halfPyramid(maleFemaleData, offset, xScale, yScale, printMale, doFill):
    
    if printMale:
        color = 'gray'
    else:
        color = 'gray!50'
    
    if doFill:
        print '\path[fill] (%f,0)[color=%s] --' % (offset, color)
    else:
        print '\draw [color=%s]' % color
    
    for (age, popMale, popFemale) in maleFemaleData:
        
        if age is not 0:
            print "--"
        
        if printMale:
            x = popMale
        else:
            x = popFemale
        
        yStart = yScale * age
        yEnd = yScale * (age + 1.0)
        
        xMaleStart = offset
        xMaleEnd = xScale * x + xMaleStart
        
        print '(%f,%f) -- (%f,%f)' % (xMaleEnd, yStart, xMaleEnd, yEnd)
    
    if doFill:
        print '(%f,%f) -- cycle;' % (offset, 100.0 * yScale)
    else:
        print ';'

xScale = 0.004
xMargin = 0.30
yScale = 0.08

halfPyramid(data, -xMargin, -xScale, yScale, True, True)
halfPyramid(data, xMargin, xScale, yScale, False, True)

pyramidLines = [20, 40, 60, 80]
yLines(-xMargin, -xScale, yScale, True, pyramidLines)
yLines(xMargin, xScale, yScale, False, pyramidLines)

halfPyramid(data, -xMargin, -xScale, yScale, False, False)
halfPyramid(data, xMargin, xScale, yScale, True, False)

for i in [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]:
    yLabel(i, yScale)

print '\\node[anchor=south] at (0,%f) {Age};' % (105.0 * yScale)
print '\\node[anchor=west] at (%s,%f) {Men};' % (-maxMale * xScale - xMargin, 100.0 * yScale)
print '\\node[anchor=east] at (%s,%f) {Women};' % (maxFemale * xScale + xMargin, 100.0 * yScale)

# Footer
print \
    '%\n' \
    '\end{tikzpicture}\n' \
    '\end{document}\n'

Lizenz

Ich, der Urheber dieses Werkes, veröffentliche es unter der folgenden Lizenz:
w:de:Creative Commons
Namensnennung
Diese Datei ist unter der Creative-Commons-Lizenz „Namensnennung 3.0 nicht portiert“ lizenziert.
Dieses Werk darf von dir
  • verbreitet werden – vervielfältigt, verbreitet und öffentlich zugänglich gemacht werden
  • neu zusammengestellt werden – abgewandelt und bearbeitet werden
Zu den folgenden Bedingungen:
  • Namensnennung – Du musst angemessene Urheber- und Rechteangaben machen, einen Link zur Lizenz beifügen und angeben, ob Änderungen vorgenommen wurden. Diese Angaben dürfen in jeder angemessenen Art und Weise gemacht werden, allerdings nicht so, dass der Eindruck entsteht, der Lizenzgeber unterstütze gerade dich oder deine Nutzung besonders.

Kurzbeschreibungen

Ergänze eine einzeilige Erklärung, was diese Datei darstellt.

In dieser Datei abgebildete Objekte

Motiv

Dateiversionen

Klicke auf einen Zeitpunkt, um diese Version zu laden.

Version vomVorschaubildMaßeBenutzerKommentar
aktuell19:03, 31. Mai 2010Vorschaubild der Version vom 31. Mai 2010, 19:03 Uhr234 × 325 (39 KB)LennyWikipedia~commonswiki{{Information |Description= |Source={{own}} |Date= |Author= Lenny222 |Permission= |other_versions= }}

Keine Seite benutzt diese Datei.