GithubHelp home page GithubHelp logo

z3tt / bib-population-pyramids Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 2.0 3.57 MB

Modern, colorful population pyramids for a report published by the "Bundesinstitut für Bevölkerungsforschung" (German Federal Institute for Population Research)

License: Creative Commons Attribution Share Alike 4.0 International

HTML 98.60% R 1.40%
ggplot2 patchwork population r rstats pyramids datavis datavisualization dataviz graphic-design

bib-population-pyramids's Introduction

CC BY-SA 4.0

 Grafiken zum Bericht
"Demografischen Wandel neu entdecken" 

Funktionen und Rmd Notebook zur Erstellung verschiedener farbenfroher Bevölkerungspyramiden in der Programmiersprache R mit der Grafikbibliothek {ggplot2}. Die Grafiken wurden verwendet, um statische Visualisierungen für den Bericht "Demografischen Wandel neu entdecken" zu erstellen, der vom Bundesinstitut für Bevölkerungsforschung (BiB) veröffentlicht wurde. Darüber hinaus wurden animierte Versionen zur Erklärung wie und warum sich die Muster im Laufe der Zeit verändern für die sozialen Medien und Webauftritte erstellt.

Datenquelle: Mikrozensus
Berechnungen: Bundesinstitut für Bevölkerungsforschung (BiB)
Grafische Darstellung: Cédric Scherer

→ Grafiken, Animationen und mehr Infos hier:
www.bib.bund.de/pyramiden


 Graphics for the report
"Rediscovering demographic change" 

Functions and Rmd notebook to create various colorful population pyramids in R with {ggplot2}. The graphics have been used to design static visualization for the report "Rediscovering demographic change" published by the German Federal Institute for Population Research (BIB). In addition, animated versions that explain how and why the patterns change over time were designed for social media and webpages.

Data source: Microcensus
Calculations: Federal Institute for Population Research (BIB)
Graphical illustration: Cédric Scherer

→ Graphics, animations and more information here:
www.bib.bund.de/pyramiden





Rohgrafiken (raw graphics)

./plots/01_bevoelkerung.png ./plots/01_bevoelkerung.png

Die beispielhaften Visualisierungen der generellen Bevölkerungsstruktur sowie des Familienstandes in Deutschland im Jahr 1991, 2006 und 2021. Die hier gezeigte Grafik ist das direkte Ergebnis des Codes und wurde in der Programmiersprache R mit Hilfe der Grafikbibliothek {ggplot2} erstellt. Die finalen statischen Visualisierungen sowie Animationen wurden im Anschluss mit einem Vektrografikprogramm erstellt.

The exemplary visualisation of the general population structure in Germany in 1991, 2006 and 2021. The graphic shown here is the direct result of the code and was created in the programming language R with the help of the graphics library {ggplot2}. The final static visualisations as well as animations were subsequently created with a vector graphics tool.

Simulation von Farbblindheit (CVD simulation)

./plots/01_bevoelkerung_cvd.png




Hinweise zum Nutzen des Codes

  • Die Daten in diesem Repository umfassen zu Illustrationszwecken lediglich die generellen Bevölkerungsdaten sowie die Daten zum Familienstand. Die anderen genutzten Daten unterliegen einer Sperrfrist und sind daher nicht Teil des Repositories.

  • Das Notebook BiB-population-pyramids.Rmd lädt die entsprechenden Daten und generiert die 3er Pyramiden als SVG Datei (zur Weiterverarbeitung) sowie Versionen mit einer Legende als PDF und PNG Dateien.

  • Das Skript src/bib-pyramid-functions.R enthält die Funktionen zur Erstellung der Pyramiden. Die Funktionen sind nested: Die Hauptfunktion ist draw_set_pyramids() (bzw. draw_set_pyramids_2()) welches die Pyramiden mit Hilfe der Funktion draw_pyramid() erstellt und anschließend in einem Gesamtlayout zusammenfügt. Die Funktion draw_pyramid() wiederum nutzt die Funktion draw_pyramid_side() zur Erstellung der linken und rechten Pyramidenhälfte. Zum Speichern der Grafiken in verschiedenen Formaten sowie zur Durchführung der Simulation von Farbblindheit wird die Funktion draw_all_pyramids() genutzt. Zudem erhält das Skript eine Helferfunktion names every_nth() sowie ein eigens für die Pyramiden entworfenes {ggplot2} Theme namens theme_bib().

  • Das Theme nutzt zwei Schriftarten, Iosevka Slab und BundesSans Web. Beide Schriftarten müssen auf dem System lokal installiert sein; erstere ist als open-source Projekt unter github.com/be5invis/Iosevka verfügbar. Die Schriftart BundesSans ist jedoch nicht frei erhältlich und muss ggf. gegen eine andere, auf dem System installierte Schriftart ausgetauscht werden.

Notes on using the code

  • The data in this repository includes only the general population data and the data sets on family status for illustrative purposes. The other data used are subject to a retention period and are therefore not part of the repository.

  • The notebook BiB-population-pyramids.Rmd loads the corresponding data and generates the 3 pyramids as SVG files (for further processing) as well as versions with a legend as PDF and PNG files.

  • The script src/bib-pyramid-functions.R contains the functions to create the pyramids. The functions are nested: The main function is draw_set_pyramids() (or draw_set_pyramids_2()) which creates the pyramids using the function draw_pyramid() and then assembles them into an overall layout. The function draw_pyramid() in turn uses the function draw_pyramid_side() to create the left and right halves of the pyramid. The function draw_all_pyramids() is used to save the graphics in different formats and to simulate colour blindness. In addition, the script holds a helper function called every_nth() as well as a specially designed {ggplot2} theme for the pyramids called theme_bib().

  • The theme uses two typefaces, Iosevka Slab and BundesSans Web. Both typefaces must be installed locally on the system; the former is available as an open-source project at github.com/be5invis/Iosevka. However, the BundesSans typefaces is not freely available and may have to be exchanged for another font installed on the system.



This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

CC BY-SA 4.0

bib-population-pyramids's People

Contributors

z3tt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

larsbrenta mcomsa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.