Convert matplotlib figures to TikZ/PGFplots code for seamless integration into LaTeX documents.
tikzplotlib is a Python library that converts matplotlib figures into TikZ/PGFplots code for direct use in LaTeX documents. It solves the problem of integrating Python-generated plots into LaTeX while preserving vector quality and editability. The tool outputs PGFPlots code, which describes graphs in terms of axes and data, making it more structured and editable than raw TikZ.
Researchers, academics, and scientists who use Python for data analysis and matplotlib for plotting, and who publish in LaTeX requiring high-quality, editable vector graphics in their documents.
Developers choose tikzplotlib because it produces cleaner, more maintainable PGFPlots code compared to matplotlib's built-in PGF/TikZ backend, ensuring plots integrate seamlessly into LaTeX workflows. Its output retains plot semantics, allowing easy customization within the TeX document itself.
:bar_chart: Save matplotlib figures as TikZ/PGFplots for smooth integration into LaTeX.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Generates PGFPlots code instead of raw TikZ, describing plots in terms of axes and data for better semantics and editability, as the README contrasts with matplotlib's backend.
Output retains matplotlib figure information, making it easily understandable and tweakable within TeX documents, and includes a clean_figure command to optimize points and curves for target resolution.
Supports both LaTeX and ConTeXt with appropriate preamble generation, catering to different TeX workflows seamlessly, as shown in the usage examples.
Designed to fit into existing TeX workflows, allowing plot adjustments as part of document preparation, which is ideal for academic publishing and consistent styling.
The README admits that 3D plots from matplotlib cannot be converted due to backend limitations, restricting use for scientific visualizations requiring three-dimensional rendering.
Requires a full TeX installation (e.g., PGFPlots) and knowledge of TeX to compile output, adding complexity and setup time compared to simple image exports like PNG or PDF.
Not all matplotlib figures convert without error, and the tool may struggle with advanced or custom plot types, necessitating manual fixes or workarounds in the generated code.
Generated PGFPlots code can be lengthy and complex for intricate plots, potentially slowing down TeX compilation times and increasing file sizes unnecessarily.