Registry / serialization / tikzplotlib

tikzplotlib

JSON →
library0.10.1pypypiunverified

tikzplotlib is a Python tool that converts matplotlib figures into TikZ/PGFPlots code, enabling LaTeX-friendly vector graphics. Current version 0.10.1, requires Python >=3.7. Released irregularly.

pip install tikzplotlib
INSTALL
IMPORT
SIG · TIKZPLOTLIB
T
tikzplotlib
serializationpythonv0.10.1
Install
8.2s avg
Import
Disk
181MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.10.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 178MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 8.2s · import 0.000s · 170MB
181MB installed
● package 181MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

tikzplotlib
import tikzplotlib
import tikzplotlib

Convert a matplotlib figure to a TikZ file using tikzplotlib.save().

import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 2*np.pi, 100) plt.plot(x, np.sin(x)) plt.title('Simple sine wave') tikzplotlib.save('sine_wave.tex')
tikzplotlib --version
Debug
Known issues
breakingIn tikzplotlib 0.10.x, the function 'tikzplotlib.save()' now returns the TikZ code as a string if no filename is given. Previously, it always wrote to a file. This can break scripts that do not expect a return value.
fix
Assign the return value or check if None when providing a filename. Use 'return_str=False' to suppress string output.
affects: >=0.10.0
deprecatedThe module 'tikzplotlib.save' is deprecated since 0.9.0. Use 'tikzplotlib.save()' directly (the function, not a submodule).
fix
Replace 'from tikzplotlib.save import ...' with 'import tikzplotlib' and call 'tikzplotlib.save(...)'.
affects: >=0.9.0
gotchatikzplotlib requires matplotlib to be installed and the figure to be fully rendered before calling save. Otherwise, the output may be incomplete or raise AttributeError.
fix
Always call plt.show() or ensure the figure is properly closed before saving, or use tikzplotlib with 'plt.gcf()'.
affects: all
Upgrade
Version history
0.10.1latest on PyPI · released Jan 31, 2022
Audit
Dependencies
numpyrequiredrequired for array handling
matplotlibrequiredrequired for figure handling
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
tikzplotlib — pip install tikzplotlib · libregistry