Metadata-Version: 2.4
Name: tikzpics
Version: 0.1.4
Summary: Python interface to generate (readable) Tikz figures.
Author: Max
Project-URL: Source, https://github.com/max-models/tikzpics
Keywords: python
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: pymupdf
Provides-Extra: dev
Requires-Dist: pyyaml; extra == "dev"
Requires-Dist: black[jupyter]; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: pyproject-fmt; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: tikzpics[docs]; extra == "dev"
Requires-Dist: tikzpics[test]; extra == "dev"
Requires-Dist: tikzpics[vis]; extra == "dev"
Provides-Extra: vis
Requires-Dist: matplotlib; extra == "vis"
Requires-Dist: jupyterlab; extra == "vis"
Provides-Extra: docs
Requires-Dist: ipykernel; extra == "docs"
Requires-Dist: mkdocs-material; extra == "docs"
Requires-Dist: mkdocs-jupyter; extra == "docs"
Requires-Dist: mkdocstrings[python]; extra == "docs"
Requires-Dist: nbconvert; extra == "docs"
Requires-Dist: numpy; extra == "docs"
Requires-Dist: scipy; extra == "docs"
Requires-Dist: tikzpics[vis]; extra == "docs"
Provides-Extra: test
Requires-Dist: coverage; extra == "test"
Requires-Dist: pytest; extra == "test"

# 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
<a href="#fig-tikzpics" class="quarto-xref">Figure 1</a>.

```python
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()
```

![](README_files/figure-markdown_strict/fig-tikzpics-output-2.png)

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

```python
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:

```python
%load_ext tikzpics.ipython
```

Then use the `%%tikz` cell magic:

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

See [tutorials](https://max-models.github.io/tikzpics/tutorials) for
more examples!
