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", color="white", fill="blue", content="Tikz")
n2 = fig.add_node(2, 0, shape="circle", color="white", fill="red", content="Pics")

fig.draw([n1, n2], options=["->", "line width=2"], 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.3       %
% https://github.com/max-models/tikzfigure        %
% --------------------------------------------- %
\begin{tikzpicture}
    \node[shape=circle, color=white, fill=blue] (node0) at (0, 0) {Tikz};
    \node[shape=circle, color=white, fill=red] (node1) at (2, 0) {Pics};
    \draw[->, line width=2, color=gray] (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.5.tar.gz (36.1 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.5-py3-none-any.whl (42.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tikzfigure-0.1.5.tar.gz
  • Upload date:
  • Size: 36.1 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.5.tar.gz
Algorithm Hash digest
SHA256 d9890069f3e7d7567736703f579e709b83f692ae44ba6f5d34a3805d2981c0b7
MD5 5c6a4f1c783e92cfc8576fe43e14e97d
BLAKE2b-256 f1ad9f31881c6f4ca0fa8c14e49bcc9f16213ad3e4a3564e2f1568ca086f887c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tikzfigure-0.1.5.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.5-py3-none-any.whl.

File metadata

  • Download URL: tikzfigure-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 42.7 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5f6fc41923ee361fad4ee54b70ac3242a971de00dafd4b18a6292b1d20f073b6
MD5 7c350b2b52786f0fb7c435f7582e9881
BLAKE2b-256 1b9055e7c52102667db03458106d588f457b50d6567c0d17b7a5ccd4df8071ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for tikzfigure-0.1.5-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