https://github.com/z3tt/bib-population-pyramids
Modern, colorful population pyramids for a report published by the "Bundesinstitut für Bevölkerungsforschung" (German Federal Institute for Population Research)
https://github.com/z3tt/bib-population-pyramids
datavis datavisualization dataviz ggplot2 graphic-design patchwork population pyramids r rstats
Last synced: 7 days ago
JSON representation
Modern, colorful population pyramids for a report published by the "Bundesinstitut für Bevölkerungsforschung" (German Federal Institute for Population Research)
- Host: GitHub
- URL: https://github.com/z3tt/bib-population-pyramids
- Owner: z3tt
- License: cc-by-sa-4.0
- Created: 2022-07-09T14:54:32.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-10T12:39:36.000Z (about 2 years ago)
- Last Synced: 2025-04-15T19:28:16.593Z (7 days ago)
- Topics: datavis, datavisualization, dataviz, ggplot2, graphic-design, patchwork, population, pyramids, r, rstats
- Language: HTML
- Homepage:
- Size: 3.49 MB
- Stars: 20
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![CC BY-SA 4.0][cc-by-sa-shield]][cc-by-sa]
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)](https://www.bib.bund.de/DE/Institut/Institut.html) 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](https://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)](https://www.bib.bund.de/EN/Institute/Institute.html). 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](https://www.bib.bund.de/pyramiden)***
---
## Rohgrafiken (*raw graphics*)

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*)

---
### Hinweise zum Nutzen des Codes
* Die [Daten](https://github.com/z3tt/BiB-population-pyramids/tree/main/data) 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`](https://github.com/z3tt/BiB-population-pyramids/blob/main/) 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`](https://github.com/z3tt/BiB-population-pyramids/blob/main/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](https://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](https://github.com/z3tt/BiB-population-pyramids/tree/main/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`](https://github.com/z3tt/BiB-population-pyramids/blob/main/) 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`](https://github.com/z3tt/BiB-population-pyramids/blob/main/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](https://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].[![CC BY-SA 4.0][cc-by-sa-image]][cc-by-sa]
[cc-by-sa]: http://creativecommons.org/licenses/by-sa/4.0/
[cc-by-sa-image]: https://licensebuttons.net/l/by-sa/4.0/88x31.png
[cc-by-sa-shield]: https://img.shields.io/badge/License-CC%20BY--SA%204.0-lightgrey.svg