All Projects → GjjvdBurg → labella.py

GjjvdBurg / labella.py

Licence: Apache-2.0 license
Python 3 clone of labella.js that generates SVG and TikZ PDF output

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to labella.py

itikz
Cell and line magic for PGF/TikZ-to-SVG rendering in Jupyter notebooks
Stars: ✭ 55 (-11.29%)
Mutual labels:  tikz, tikz-figures
Circuitikz
CircuiTikZ TeX/LaTeX package for drawing circuits
Stars: ✭ 222 (+258.06%)
Mutual labels:  tikz
lazylatex
Because LaTeX shouldn't be boring! 🐠 LaTeX package inspired by sphinx-rtd-theme. Build with tcolorbox, minted, tikz, etc,.
Stars: ✭ 16 (-74.19%)
Mutual labels:  tikz
Tikz Feynman
Feynman Diagrams with TikZ
Stars: ✭ 104 (+67.74%)
Mutual labels:  tikz
Tikz
Complete collection of my PGF/TikZ figures.
Stars: ✭ 668 (+977.42%)
Mutual labels:  tikz
Quiver
A modern commutative diagram editor for the web.
Stars: ✭ 1,799 (+2801.61%)
Mutual labels:  tikz
tikz-feyn
A LaTeX package to draw Feynman diagrams using TikZ
Stars: ✭ 16 (-74.19%)
Mutual labels:  tikz
tikzlings
Collection of animals and other beings drawn in TikZ
Stars: ✭ 80 (+29.03%)
Mutual labels:  tikz
Sane tikz
Reconquer the canvas: beautiful Tikz figures without clunky Tikz code
Stars: ✭ 196 (+216.13%)
Mutual labels:  tikz
Tikzplotlib
Convert matplotlib figures to TikZ/PGFplots for smooth integration into LaTeX.
Stars: ✭ 1,338 (+2058.06%)
Mutual labels:  tikz
Matlab2tikz
This program converts MATLAB®/Octave figures to TikZ/pgfplots figures for smooth integration into LaTeX.
Stars: ✭ 1,041 (+1579.03%)
Mutual labels:  tikz
Awesome Tikz
A curated list of awesome TikZ documentations, libraries and resources
Stars: ✭ 804 (+1196.77%)
Mutual labels:  tikz
Latex Cheatsheet
Template for a compact LaTeX Cheatsheet I made some years ago.
Stars: ✭ 136 (+119.35%)
Mutual labels:  tikz
tikz favorites
collection of favorite TikZ graphics
Stars: ✭ 62 (+0%)
Mutual labels:  tikz
Ktikz
KtikZ provides a nice user interface for making pictures using TikZ.
Stars: ✭ 233 (+275.81%)
Mutual labels:  tikz
metapict
A graphics library for producing Racket picts in a MetaPost/TikZ style.
Stars: ✭ 37 (-40.32%)
Mutual labels:  tikz
Latex Examples
Examples for the usage of LaTeX
Stars: ✭ 1,032 (+1564.52%)
Mutual labels:  tikz
Tikzcd Editor
A simple visual editor for creating commutative diagrams.
Stars: ✭ 1,627 (+2524.19%)
Mutual labels:  tikz
tikz-pgfplots-projects
Projects using tikz and pgfplots.
Stars: ✭ 33 (-46.77%)
Mutual labels:  tikz
Tikz
Galley of Tikz drawings.
Stars: ✭ 251 (+304.84%)
Mutual labels:  tikz

labella.py

https://pepy.tech/badge/labella

Labella.py is a Python 3 clone of labella.js that supports all the features of labella.js and addionally can generate TikZ PDF images for use in LaTeX.

Note: This package is for the most part a direct translation of the original labella.js code to Python 3. All the credit for the labella code goes to Krist Wongsuphasawat (@kristw), I only added the code that generates PDF output. Labella.py also includes code from d3 for axis scaling, and WebCola for the VPSC code (label placement optimization).

Why?

I wrote this for multiple reasons, the most important of which is that I wanted to incorporate label graphs like the ones generated by labella.js in PDF documents, but wasn't satisfied with the PDF output generated by SVG-to-PDF converters. Additionally, it seemed like a fun way to learn some more Javascript, and learn about how labella.js works.

Screenshots

These screenshots show the PDF output generated by labella.py (converted to .png)

Time scale:

Example of Labella.py output for a timeline

Linear scale:

Example of Labella.py output for a timeline

Usage

Using labella.py is extremely similar to using labella.js. See the examples directory for examples of how to use labella.py. These examples are translations of the examples included in labella.js and in d3kit-timeline.

For ease of use only the Timeline interface is implemented, which works similar to d3kit-timeline. Here is a minimal working example for exporting to PDF:

>>> from labella.scale import LinearScale
>>> from labella.timeline import TimelineTex
>>> tl = TimelineTex([
  {'time': 1, 'text': 'Minimal'},
  {'time': 2, 'text': 'Working'},
  {'time': 3, 'text': 'Example'}
  ], options={'scale': LinearScale()})
>>> tl.export('minimal.tex')

See also the documentation here.

Installation

Labella.py is available through PyPi, so you can do:

pip install labella

to install it.

Note: Labella.py requires a working LaTeX distribution for both SVG and PDF output (see also the documentation), and has only been tested on Linux. If you run into problems, please open an issue on GitHub.

Author

Gertjan van den Burg (@GjjvdBurg).

Licensed under the Apache License Version 2.0.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].