Skip to main content

Python interface to generate (readable) Tikz figures.

Project description

Tikzpics

Python interface to generate (readable) Tikz figures.

Install

Create and activate python environment, then install tikzpics with

pip install tikzpics

Examples

Generate tikz-figures with Python API

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

from tikzpics 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 tikzpics v0.1.3       %
% https://github.com/max-models/tikzpics        %
% --------------------------------------------- %
\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 "tikzpics[vis]"

IPython Magic Commands

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

Load the extension:

%load_ext tikzpics.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

tikzpics-0.1.4.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.

tikzpics-0.1.4-py3-none-any.whl (42.6 kB view details)

Uploaded Python 3

File details

Details for the file tikzpics-0.1.4.tar.gz.

File metadata

  • Download URL: tikzpics-0.1.4.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 tikzpics-0.1.4.tar.gz
Algorithm Hash digest
SHA256 deb4cf2313d4f50fd70dfd06677728c20461983e7ddaf914759f4e8d85836535
MD5 4875b5aacf8f3be893a7f9e1a7a0a616
BLAKE2b-256 8fedc81d5a697082a3696a5ac5073c8628dae570f5c9c38d6b4c08a0629be72c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tikzpics-0.1.4.tar.gz:

Publisher: publish_pypi.yml on max-models/tikzpics

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

File details

Details for the file tikzpics-0.1.4-py3-none-any.whl.

File metadata

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

File hashes

Hashes for tikzpics-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f64d70c1b6d81ac9f2b9e6412196fe1dd374a2905ead4ac8e09ed775b4c1d9f4
MD5 4f58c755f5d1bb1e0acd390a9008754a
BLAKE2b-256 2996f7ebad0de1a74eb01a542e45039f004a90cbaf8a5c4f4c57a8e19cd87e00

See more details on using hashes here.

Provenance

The following attestation bundles were made for tikzpics-0.1.4-py3-none-any.whl:

Publisher: publish_pypi.yml on max-models/tikzpics

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