cacrespo / pylexis

Draws a Lexis Diagram with Python
MIT License
8 stars 2 forks source link

PyLexis

PyLexis is a tool to easily plot Lexis Diagrams within Python. It is based on matplotlib and inspirated in LexisPlotR.

What is a Lexis Diagram?

In demography a Lexis diagram (named after economist and social scientist Wilhelm Lexis) is a two dimensional diagram that is used to represent events (such as births or deaths) that occur to individuals belonging to different cohorts. Calendar time is usually represented on the horizontal axis, while age is represented on the vertical axis. (https://en.wikipedia.org/wiki/Lexis_diagram)

Installation

pip install pylexis

Using PyLexis

First import the package and create a Diagram object with the following arguments:

initial year, _finalyear, _firstage, _lastage

import pylexis
diagram = pylexis.Diagram(1900, 1910, 0, 10)

This returns a basic diagram:

Then you have a few methods to interact with the graph:

Styling


Graphing Data

Examples

Basic Diagram

Add Data Points and Texts

How to contribute to the project?

Please check the how to contribute instructions.

FAQ

Just ask me what you need!