Name | tikzplotly JSON |
Version |
0.1.7
JSON |
| download |
home_page | None |
Summary | Convert plotly figures to LaTeX / tikz figures |
upload_time | 2024-07-17 12:39:26 |
maintainer | None |
docs_url | None |
author | None |
requires_python | None |
license | The MIT License (MIT) Copyright (c) 2023 @thomas-saigre Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
plotly
latex
tikz
figure
conversion
graphics
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
![logo-tikzplotly](https://raw.githubusercontent.com/thomas-saigre/tikzplotly/main/doc/img/logo.svg "Tikzplotly")
[![PyPi Version](https://img.shields.io/pypi/v/tikzplotly.svg?style=flat-square)](https://pypi.org/project/tikzplotly)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/tikzplotly.svg?style=flat-square)](https://pypi.org/pypi/tikzplotly/)
[![Issue](https://img.shields.io/github/issues-raw/thomas-saigre/tikzplotly?style=flat-square)](https://github.com/thomas-saigre/tikzplotly/issues)
[![codecov](https://img.shields.io/codecov/c/github/thomas-saigre/tikzplotly.svg?style=flat-square)](https://codecov.io/gh/thomas-saigre/tikzplotly)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/thomas-saigre/tikzplotly/ci.yml?style=flat-square)
# Tikzplotly
Convert [plotly](https://plotly.com/python/) figures to tikz code for inclusion into [PGFPlots](https://www.ctan.org/pkg/pgfplots) ([PGF/TikZ](https://www.ctan.org/pkg/pgf)) figures.
This results in a ti*k*z code, that can be easily included into your LaTeX document.
This also allows to easily edit the content of the figure.
## Example
The following Python code
```python
import plotly.express as px
import tikzplotly
df = px.data.gapminder().query("continent == 'Oceania'")
fig = px.line(df, x='year', y='lifeExp', color='country', markers=True)
tikzplotly.save("example.tex", fig)
```
will result in the following ti*k*z code
```latex
\pgfplotstableread{data0 Australia New_Zealand
1952 69.12 69.39
1957 70.33 70.26
1962 70.93 71.24
1967 71.1 71.52
1972 71.93 71.89
1977 73.49 72.22
1982 74.74 73.84
1987 76.32 74.32
1992 77.56 76.33
1997 78.83 77.55
2002 80.37 79.11
2007 81.235 80.204
}\dataZ
\begin{tikzpicture}
\definecolor{636efa}{HTML}{636efa}
\definecolor{EF553B}{HTML}{EF553B}
\begin{axis}[
xlabel=year,
ylabel=lifeExp,
]
\addplot+ [mark=*, solid, color=636efa, mark options={solid, draw=636efa}] table[y=Australia] {\dataZ};
\addlegendentry{Australia}
\addplot+ [mark=*, solid, color=EF553B, mark options={solid, draw=EF553B}] table[y=New_Zealand] {\dataZ};
\addlegendentry{New Zealand}
\end{axis}
\end{tikzpicture}
```
## Installation
Tikzplotly is available from the [Python Package Index](https://pypi.org/project/tikzplotly/), so it can be installed with `pip` :
```bash
pip install tikzplotly
```
## Usage
1. Generate the figure with Plotly,
2. Invoke `tikzplotly` to convert the figure to ti*k*z code :
```py
import tikzplotly
tikzplotly.save("figure.tex", fig)
```
3. Add the content of the generated file `figure.tex` to your LaTeX document :
```latex
\input{figure.tex}
```
To correctly compile the document, you will need to add the following packages to your preamble :
```latex
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
```
## 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.
* More details in [doc/NB.md](doc/NB.md).
## References
* [plotly](https://plotly.com/python/)
* [PGFPlots](https://www.ctan.org/pkg/pgfplots) (with [manual](https://ctan.mines-albi.fr/graphics/pgf/contrib/pgfplots/doc/pgfplots.pdf))
* [PGF/TikZ](https://www.ctan.org/pkg/pgf)
* [tikzplotlib](https://github.com/nschloe/tikzplotlib) : a similar project for matplotlib figures from which this one is inspired.
## License
This project is licensed under the MIT [License](LICENSE).
Raw data
{
"_id": null,
"home_page": null,
"name": "tikzplotly",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "plotly, latex, tikz, figure, conversion, graphics",
"author": null,
"author_email": "Thomas Saigre <tikzplotly@outlook.fr>",
"download_url": "https://files.pythonhosted.org/packages/23/d2/bae92c81d7f9f549f24cbbeffab273222e7c56830b507d81755043154b21/tikzplotly-0.1.7.tar.gz",
"platform": null,
"description": "![logo-tikzplotly](https://raw.githubusercontent.com/thomas-saigre/tikzplotly/main/doc/img/logo.svg \"Tikzplotly\")\n\n[![PyPi Version](https://img.shields.io/pypi/v/tikzplotly.svg?style=flat-square)](https://pypi.org/project/tikzplotly)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/tikzplotly.svg?style=flat-square)](https://pypi.org/pypi/tikzplotly/)\n\n[![Issue](https://img.shields.io/github/issues-raw/thomas-saigre/tikzplotly?style=flat-square)](https://github.com/thomas-saigre/tikzplotly/issues)\n[![codecov](https://img.shields.io/codecov/c/github/thomas-saigre/tikzplotly.svg?style=flat-square)](https://codecov.io/gh/thomas-saigre/tikzplotly)\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/thomas-saigre/tikzplotly/ci.yml?style=flat-square)\n\n\n# Tikzplotly\n\nConvert [plotly](https://plotly.com/python/) figures to tikz code for inclusion into [PGFPlots](https://www.ctan.org/pkg/pgfplots) ([PGF/TikZ](https://www.ctan.org/pkg/pgf)) figures.\n\nThis results in a ti*k*z code, that can be easily included into your LaTeX document.\nThis also allows to easily edit the content of the figure.\n\n## Example\n\nThe following Python code\n\n```python\nimport plotly.express as px\nimport tikzplotly\n\ndf = px.data.gapminder().query(\"continent == 'Oceania'\")\nfig = px.line(df, x='year', y='lifeExp', color='country', markers=True)\ntikzplotly.save(\"example.tex\", fig)\n```\n\nwill result in the following ti*k*z code\n\n```latex\n\\pgfplotstableread{data0 Australia New_Zealand\n1952 69.12 69.39\n1957 70.33 70.26\n1962 70.93 71.24\n1967 71.1 71.52\n1972 71.93 71.89\n1977 73.49 72.22\n1982 74.74 73.84\n1987 76.32 74.32\n1992 77.56 76.33\n1997 78.83 77.55\n2002 80.37 79.11\n2007 81.235 80.204\n}\\dataZ\n\n\\begin{tikzpicture}\n\n\\definecolor{636efa}{HTML}{636efa}\n\\definecolor{EF553B}{HTML}{EF553B}\n\n\\begin{axis}[\nxlabel=year,\nylabel=lifeExp,\n]\n\\addplot+ [mark=*, solid, color=636efa, mark options={solid, draw=636efa}] table[y=Australia] {\\dataZ};\n\\addlegendentry{Australia}\n\\addplot+ [mark=*, solid, color=EF553B, mark options={solid, draw=EF553B}] table[y=New_Zealand] {\\dataZ};\n\\addlegendentry{New Zealand}\n\\end{axis}\n\\end{tikzpicture}\n```\n\n## Installation\n\nTikzplotly is available from the [Python Package Index](https://pypi.org/project/tikzplotly/), so it can be installed with `pip` :\n\n```bash\npip install tikzplotly\n```\n\n## Usage\n\n1. Generate the figure with Plotly,\n2. Invoke `tikzplotly` to convert the figure to ti*k*z code :\n```py\nimport tikzplotly\n\ntikzplotly.save(\"figure.tex\", fig)\n```\n3. Add the content of the generated file `figure.tex` to your LaTeX document :\n```latex\n\\input{figure.tex}\n```\nTo correctly compile the document, you will need to add the following packages to your preamble :\n```latex\n\\usepackage{pgfplots}\n\\pgfplotsset{compat=newest}\n```\n\n\n## Note\n\n* 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.\nYou can also submit a pull request with the desired feature !\n* Some feature can result in different output between the plotly figure and the tikz figure, for instance the size of markers.\n* More details in [doc/NB.md](doc/NB.md).\n\n\n## References\n\n* [plotly](https://plotly.com/python/)\n* [PGFPlots](https://www.ctan.org/pkg/pgfplots) (with [manual](https://ctan.mines-albi.fr/graphics/pgf/contrib/pgfplots/doc/pgfplots.pdf))\n* [PGF/TikZ](https://www.ctan.org/pkg/pgf)\n* [tikzplotlib](https://github.com/nschloe/tikzplotlib) : a similar project for matplotlib figures from which this one is inspired.\n\n\n## License\n\nThis project is licensed under the MIT [License](LICENSE).\n",
"bugtrack_url": null,
"license": "The MIT License (MIT) Copyright (c) 2023 @thomas-saigre Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Convert plotly figures to LaTeX / tikz figures",
"version": "0.1.7",
"project_urls": {
"Code": "https://github.com/thomas-saigre/tikzplotly",
"Issues": "https://github.com/thomas-saigre/tikzplotly/issues"
},
"split_keywords": [
"plotly",
" latex",
" tikz",
" figure",
" conversion",
" graphics"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3c06cd978650a73226d90205e1082bbbc88ac4eff5c86013635213a54494c179",
"md5": "13c49e3674eaa2321615f0d768d84e35",
"sha256": "b7f807d9ce10f5d54161838fe12a542eb41e7a6cf1061cd8eb399a391b45d4bb"
},
"downloads": -1,
"filename": "tikzplotly-0.1.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "13c49e3674eaa2321615f0d768d84e35",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 37987,
"upload_time": "2024-07-17T12:39:25",
"upload_time_iso_8601": "2024-07-17T12:39:25.590751Z",
"url": "https://files.pythonhosted.org/packages/3c/06/cd978650a73226d90205e1082bbbc88ac4eff5c86013635213a54494c179/tikzplotly-0.1.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "23d2bae92c81d7f9f549f24cbbeffab273222e7c56830b507d81755043154b21",
"md5": "dadbf196b60cc7efd676883b6f85f727",
"sha256": "0add44f0620a68b68d7590f11108ad028576489e9b7cb1d5d6400a0bb93319e3"
},
"downloads": -1,
"filename": "tikzplotly-0.1.7.tar.gz",
"has_sig": false,
"md5_digest": "dadbf196b60cc7efd676883b6f85f727",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 37731,
"upload_time": "2024-07-17T12:39:26",
"upload_time_iso_8601": "2024-07-17T12:39:26.856819Z",
"url": "https://files.pythonhosted.org/packages/23/d2/bae92c81d7f9f549f24cbbeffab273222e7c56830b507d81755043154b21/tikzplotly-0.1.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-17 12:39:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "thomas-saigre",
"github_project": "tikzplotly",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "tikzplotly"
}