Convert plotly figures to LaTeX / tikz figures
Project description
Tikzplotly
Convert plotly figures to tikz code for inclusion into PGFPlots (PGF/TikZ) figures.
This results in a tikz code, that can be easily included into your LaTeX document. This also allow to easily edit the content of the figure.
Example
The following Python code
import plotly.express as px
import tikzplotly
df = px.data.gapminder().query("country=='Canada'")
fig = px.line(df, x="year", y="lifeExp", title='Life expectancy in Canada')
tikzplotly.save("example.tex", fig)
will result in the following tikz code
% This file was created with tikzplotly version 0.0.1.
\begin{tikzpicture}
\definecolor{636efa}{HTML}{636efa}
\begin{axis}[
title=Life expectancy in Canada,
xlabel=year,
ylabel=lifeExp,
]
\addplot+ [mark=none, solid, color=636efa, forget plot] table {%
1952 68.75
1957 69.96
1962 71.3
1967 72.13
1972 72.88
1977 74.21
1982 75.76
1987 76.86
1992 77.95
1997 78.61
2002 79.77
2007 80.653
};
\end{axis}
\end{tikzpicture}
Note
- This module is in development and new features are added bit by bit, when needed. If you have a feature request, please open an issue with the plotly figure you want to convert and the desired output. You can also submit a pull request with the desired feature !
- Some feature can result in different output between the plotly figure and the tikz figure, for instance the size of markers.
References
- plotly
- PGFPlots
- PGF/TikZ
- tikzplotlib : a similar project for matplotlib figures from which this one is inspired.
License
This project is licensed under the MIT License.
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
tikzplotly-0.1.0.tar.gz
(24.1 kB
view details)
Built Distribution
File details
Details for the file tikzplotly-0.1.0.tar.gz
.
File metadata
- Download URL: tikzplotly-0.1.0.tar.gz
- Upload date:
- Size: 24.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7aec5a69ce3f8399883d30ceff680d914dd745c9e9f72469dc904a29779bca0 |
|
MD5 | a05199e2626fc83fb09b4de12fa5135c |
|
BLAKE2b-256 | ea0c1b33b47d889ab8b194a22c873a2a19f0af7051e4cb84f417c0c49e2600ec |
File details
Details for the file tikzplotly-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: tikzplotly-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | acab88518d381428f2f8bc7233a83ca46a897b8f0310dbd396620fc7cde23471 |
|
MD5 | 1a50d4ced7474c38e05a82f48d9827e4 |
|
BLAKE2b-256 | d50f97a06e9d5013cb90b248714ef12bb23548d898832e58a69ddc53a7e48577 |