skip to navigation
skip to content

Not Logged In

ZikT 0.1

Python lib for generating TikZ charts from table data

Latest Version: 0.1.3

What is ZikT?

ZikT creates charts like pie charts and bar charts for LaTeX documents. Therefore, ZikT turns table data into TikZ code, that can be embedded or inputted in any LaTeX document. TikZ (and the underlying PGF) is a macro package for TeX. You can find beautiful examples for graphics created with TikZ on texample.net.

ZikT can be used as Python library to create TikZ code for charts from you own Python stuff. ZikT can also be used as script that reads in CSV data, takes a chart specification and prints out the resulting TikZ code to stdout. A sample usage of this script on Linux is

zikt -l mydata.csv -r "BarChart(additionalBarStyle='fill=red')" > mychart.tex

Currently, ZikT supports these chart types:

  • bar charts
  • grouped bar charts
  • stacked bar charts
  • pie charts
  • plot charts

ZikT is in an early and experimental state and lacks a lot of important features like the creation of a chart legend. Working features are for example a flexible way to specify labels and automated axis labeling.

Further Information

Do I need to know LaTeX to use ZikT?

Well, some very basic knowledge to embed the TikZ code and to compile the document is needed. But―of cause―you will need to know LaTeX if you want to write documents around your charts. :)

Do I need to know TikZ/PGF to use ZikT?

No. But if you do, you will have more options to style your charts and you will be able to manipulate and extend ZikTs output manually.

Can I use ZikT without programming Python?

I have written a simple command line front end for ZikT. It enables you to read in a CSV file and to print out the charts TikZ code to stdout. This front end script is zikt.py which can be found within the zikt package.

Is there any further documentation?

I’m working on a LaTeX based documentation but it is in an even earlier state than ZikT itself (surprise!). It is currently not available with the package. If you are intrested in this, let me know and maybe I will hurry up a little with the documentation.

Short example for programmatic usage?

Okay.

from zikt.tables import FloatTable
from zikt.barchart import BarChart

data = [
        ['A','B','C'],
        [2,12,-3]
        ]

table = FloatTable(data)

chart = BarChart()

chartCode = chart.render(table)

print "\\begin{tikzpicture}"
print chartCode
print "\\end{tikzpicture}"

Pipe the output of this program into a file in a an empty directory. On Linux it may

./upper_script.py > diagram.tex

The TikZ output of ZikT depends on several color and TikZ definitions that are located in zikt.sty, delivered with the package in the latex sub package. As a convenience function, the zikt script can print it to stdout. So, the easiest option is to use a zikt.sty copy for each LaTeX document containing ZikT charts. Create that zikt.sty in your working directory. On Linux it may look like this:

zikt --printsty > zikt.sty

Last but not least you need the surrounding document. Create mydoc.tex with something like following content:

\documentclass{scrartcl}
\usepackage{zikt}
\begin{document}
 \input{diagram}
\end{document}

Compile that file with a compatible LaTeX compiler. I would use lualatex -interaction=nonstopmode mydoc.tex. You should have a very senseless mydoc.pdf then where you can see a very basic ZikT bar chart.

 
File Type Py Version Uploaded on Size
ZikT-0.1.tar.gz (md5) Source 2014-04-22 28KB
  • Downloads (All Versions):
  • 0 downloads in the last day
  • 26 downloads in the last week
  • 188 downloads in the last month