Skip to main content

Python interface to generate (readable) Tikz figures.

Project description

tikzfigure

Python interface to generate (readable) Tikz figures.

Install

Create and activate python environment, then install tikzfigure with

pip install tikzfigure

Examples

Generate tikz-figures with Python API

Generate two nodes connected by an arrow, see Figure 1.

from tikzfigure import TikzFigure

fig = TikzFigure()

n1 = fig.add_node(0, 0, shape="circle", fill="blue!40!green", content="Tikz")
n2 = fig.add_node(2, 0, shape="circle", fill="purple!40!orange", content="Figure")

fig.draw([n1, n2], line_width=2, arrows="->", color="gray")

fig.show()

You can also save the figure as a .tikz file or print the LaTeX code:

print(fig)
% --------------------------------------------- %
% Tikzfigure generated by tikzfigure v0.1.4     %
% https://github.com/max-models/tikzfigure      %
% --------------------------------------------- %
\begin{tikzpicture}
    \node[shape=circle, fill=blue!40!green] (node0) at (0, 0) {Tikz};
    \node[shape=circle, fill=purple!40!orange] (node1) at (2, 0) {Figure};
    \draw[color=gray, line width=2, arrows=->] (node0) to (node1);
\end{tikzpicture}

Note that to visualize the plots in a popup or in jupyterlab, install with pip install "tikzfigure[vis]"

IPython Magic Commands

tikzfigure includes IPython magic commands for compiling TikZ figures directly in Jupyter notebooks!

Load the extension:

%load_ext tikzfigure.ipython

Then use the %%tikz cell magic:

%%tikz
\begin{tikzpicture}
\draw[thick, blue] (0,0) circle (2cm);
\node at (0,0) {Hello TikZ!};
\end{tikzpicture}

See tutorials for more examples!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tikzfigure-0.1.6.tar.gz (43.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tikzfigure-0.1.6-py3-none-any.whl (52.5 kB view details)

Uploaded Python 3

File details

Details for the file tikzfigure-0.1.6.tar.gz.

File metadata

  • Download URL: tikzfigure-0.1.6.tar.gz
  • Upload date:
  • Size: 43.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tikzfigure-0.1.6.tar.gz
Algorithm Hash digest
SHA256 752c6eff7a715209646692a2b7409ceab22c7c42f89ed53ef87d2c6f8f701872
MD5 dd3a8ef0d44b4005849bf15dd38cb2bc
BLAKE2b-256 b255524adb159d79461520089709ca016be023dd0119c755431a3f6cda2a3fcc

See more details on using hashes here.

Provenance

The following attestation bundles were made for tikzfigure-0.1.6.tar.gz:

Publisher: publish_pypi.yml on max-models/tikzfigure

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tikzfigure-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: tikzfigure-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 52.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tikzfigure-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 324305e1af3f709b8af23a3016f65ee10786018256cb2e0fb763ffc8ab1c8112
MD5 89e61b363074b59feda37e843401a1b5
BLAKE2b-256 26e8388c5d0485819ace13df4a78a87949b651222667c2d7f576874b944eab39

See more details on using hashes here.

Provenance

The following attestation bundles were made for tikzfigure-0.1.6-py3-none-any.whl:

Publisher: publish_pypi.yml on max-models/tikzfigure

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page