tikzplotly


Nametikzplotly JSON
Version 0.1.3 PyPI version JSON
download
home_page
SummaryConvert plotly figures to LaTeX / tikz figures
upload_time2024-03-03 09:06:11
maintainer
docs_urlNone
author
requires_python
licenseThe 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)

# 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": "",
    "name": "tikzplotly",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "plotly,latex,tikz,figure,conversion,graphics",
    "author": "",
    "author_email": "Thomas Saigre <tikzplotly@outlook.fr>",
    "download_url": "https://files.pythonhosted.org/packages/c8/48/1fbdb0812a0747624ff7e65fe03e1ed295dd4933350516841fe564edd304/tikzplotly-0.1.3.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\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.3",
    "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": "159421e6a34b0a2be8cc452f12e02655b7fa5d3dfb93dcf6412d679a3c5fdef7",
                "md5": "558c1984104c52e5d01e84501ffea9a1",
                "sha256": "520f366bc515232d21d84d126ae55f9fa1dbc0a1f3ee4332cb9551b5a3452467"
            },
            "downloads": -1,
            "filename": "tikzplotly-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "558c1984104c52e5d01e84501ffea9a1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 24491,
            "upload_time": "2024-03-03T09:06:10",
            "upload_time_iso_8601": "2024-03-03T09:06:10.685378Z",
            "url": "https://files.pythonhosted.org/packages/15/94/21e6a34b0a2be8cc452f12e02655b7fa5d3dfb93dcf6412d679a3c5fdef7/tikzplotly-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c8481fbdb0812a0747624ff7e65fe03e1ed295dd4933350516841fe564edd304",
                "md5": "09322b2b1f53ea0c94811e0baa58ec57",
                "sha256": "43d11ac820459aa492da20d95b756a10262f431d896847d2d7a7a6099ea7fe7f"
            },
            "downloads": -1,
            "filename": "tikzplotly-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "09322b2b1f53ea0c94811e0baa58ec57",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 29691,
            "upload_time": "2024-03-03T09:06:11",
            "upload_time_iso_8601": "2024-03-03T09:06:11.838411Z",
            "url": "https://files.pythonhosted.org/packages/c8/48/1fbdb0812a0747624ff7e65fe03e1ed295dd4933350516841fe564edd304/tikzplotly-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-03 09:06:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "thomas-saigre",
    "github_project": "tikzplotly",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "tikzplotly"
}
        
Elapsed time: 0.21361s