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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9890069f3e7d7567736703f579e709b83f692ae44ba6f5d34a3805d2981c0b7
|
|
| MD5 |
5c6a4f1c783e92cfc8576fe43e14e97d
|
|
| BLAKE2b-256 |
f1ad9f31881c6f4ca0fa8c14e49bcc9f16213ad3e4a3564e2f1568ca086f887c
|
Provenance
The following attestation bundles were made for tikzfigure-0.1.5.tar.gz:
Publisher:
publish_pypi.yml on max-models/tikzfigure
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tikzfigure-0.1.5.tar.gz -
Subject digest:
d9890069f3e7d7567736703f579e709b83f692ae44ba6f5d34a3805d2981c0b7 - Sigstore transparency entry: 1193832628
- Sigstore integration time:
-
Permalink:
max-models/tikzfigure@6d7b14a952e2f555439226bfb4925341c1debcc1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/max-models
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yml@6d7b14a952e2f555439226bfb4925341c1debcc1 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f6fc41923ee361fad4ee54b70ac3242a971de00dafd4b18a6292b1d20f073b6
|
|
| MD5 |
7c350b2b52786f0fb7c435f7582e9881
|
|
| BLAKE2b-256 |
1b9055e7c52102667db03458106d588f457b50d6567c0d17b7a5ccd4df8071ef
|
Provenance
The following attestation bundles were made for tikzfigure-0.1.5-py3-none-any.whl:
Publisher:
publish_pypi.yml on max-models/tikzfigure
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tikzfigure-0.1.5-py3-none-any.whl -
Subject digest:
5f6fc41923ee361fad4ee54b70ac3242a971de00dafd4b18a6292b1d20f073b6 - Sigstore transparency entry: 1193832682
- Sigstore integration time:
-
Permalink:
max-models/tikzfigure@6d7b14a952e2f555439226bfb4925341c1debcc1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/max-models
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_pypi.yml@6d7b14a952e2f555439226bfb4925341c1debcc1 -
Trigger Event:
push
-
Statement type: