From c8c3f9e63919e8e26ed6faa957d3bd08bda9c968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Thu, 30 Sep 2021 10:12:10 +0200 Subject: [PATCH 1/5] explicitly support python 3.10 --- .github/workflows/ci.yml | 2 +- README.md | 30 +++++++++++++++++------------- setup.cfg | 1 + 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a6bd22b..b82c9120 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10-dev"] steps: - uses: actions/setup-python@v2 with: diff --git a/README.md b/README.md index 630711b6..e9b1b771 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,9 @@ figures like for native inclusion into LaTeX or ConTeXt documents. -The output of tikzplotlib is in -[PGFPlots](https://github.com/pgf-tikz/pgfplots/), a TeX library that sits on -top of [PGF/TikZ](https://en.wikipedia.org/wiki/PGF/TikZ) and describes graphs in terms -of axes, data etc. Consequently, the output of tikzplotlib +The output of tikzplotlib is in [PGFPlots](https://github.com/pgf-tikz/pgfplots/), a TeX +library that sits on top of [PGF/TikZ](https://en.wikipedia.org/wiki/PGF/TikZ) and +describes graphs in terms of axes, data etc. Consequently, the output of tikzplotlib - retains more information, - can be more easily understood, and @@ -58,14 +57,17 @@ import tikzplotlib tikzplotlib.save("test.tex") ``` + + ```python import matplotlib as mpl plt.close() mpl.rcParams.update(mpl.rcParamsDefault) ``` + --> (see above) gives @@ -147,8 +149,8 @@ to install. to store the TikZ file as `mytikz.tex`. -3. Add the contents of `mytikz.tex` into your TeX source code. A convenient way of - doing so is via +3. Add the contents of `mytikz.tex` into your TeX source code. A convenient way of doing + so is via ```latex \input{/path/to/mytikz.tex} @@ -189,7 +191,8 @@ to install. tikzplotlib.Flavors.context.preamble() ``` -4. Optional: clean up the figure before exporting to tikz using the `clean_figure` command. +4. [Optional] Clean up the figure before exporting to tikz using the `clean_figure` + command. ```python import matplotlib.pyplot as plt @@ -212,16 +215,16 @@ to install. ### Contributing -If you experience bugs, would like to contribute, have nice examples of what -tikzplotlib can do, or if you are just looking for more information, then please -visit [tikzplotlib's GitHub page](https://github.com/nschloe/tikzplotlib). +If you experience bugs, would like to contribute, have nice examples of what tikzplotlib +can do, or if you are just looking for more information, then please visit +[tikzplotlib's GitHub page](https://github.com/nschloe/tikzplotlib). ### Testing tikzplotlib has automatic unit testing to make sure that the software doesn't accidentally get worse over time. In `test/`, a number of test cases are specified. -Those run through tikzplotlib and compare the output with a previously stored -reference TeX file. +Those run through tikzplotlib and compare the output with a previously stored reference +TeX file. To run the tests, just check out this repository and type @@ -231,4 +234,5 @@ pytest ### License -tikzplotlib is published under the [MIT license](https://en.wikipedia.org/wiki/MIT_License). +tikzplotlib is published under the [MIT +license](https://en.wikipedia.org/wiki/MIT_License). diff --git a/setup.cfg b/setup.cfg index 2bec28c5..bb28cc73 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,6 +24,7 @@ classifiers = Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Topic :: Multimedia :: Graphics :: Graphics Conversion Topic :: Scientific/Engineering :: Visualization keywords = From f1c0c09b314810299b8a655aac69a582536f7306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Thu, 30 Sep 2021 10:15:31 +0200 Subject: [PATCH 2/5] future annotations --- src/tikzplotlib/_save.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/tikzplotlib/_save.py b/src/tikzplotlib/_save.py index 0dc7e631..3efaad42 100644 --- a/src/tikzplotlib/_save.py +++ b/src/tikzplotlib/_save.py @@ -1,8 +1,9 @@ +from __future__ import annotations + import enum import pathlib import tempfile import warnings -from typing import List, Optional, Set, Union import matplotlib as mpl import matplotlib.pyplot as plt @@ -17,22 +18,22 @@ def get_tikz_code( figure="gcf", - filepath: Optional[Union[str, pathlib.Path]] = None, - axis_width: Optional[str] = None, - axis_height: Optional[str] = None, + filepath: str | pathlib.Path | None = None, + axis_width: str | None = None, + axis_height: str | None = None, textsize: float = 10.0, - tex_relative_path_to_data: Optional[str] = None, + tex_relative_path_to_data: str | None = None, externalize_tables: bool = False, override_externals: bool = False, - externals_search_path: Optional[str] = None, + externals_search_path: str | None = None, strict: bool = False, wrap: bool = True, add_axis_environment: bool = True, - extra_axis_parameters: Optional[Union[List, Set]] = None, + extra_axis_parameters: list | set | None = None, extra_groupstyle_parameters: dict = {}, - extra_tikzpicture_parameters: Optional[Union[List, Set]] = None, - extra_lines_start: Optional[Union[List, Set]] = None, - dpi: Optional[int] = None, + extra_tikzpicture_parameters: list | set | None = None, + extra_lines_start: list | set | None = None, + dpi: int | None = None, show_info: bool = False, include_disclaimer: bool = True, standalone: bool = False, @@ -246,9 +247,7 @@ def get_tikz_code( return code -def save( - filepath: Union[str, pathlib.Path], *args, encoding: Optional[str] = None, **kwargs -): +def save(filepath: str | pathlib.Path, *args, encoding: str | None = None, **kwargs): """Same as `get_tikz_code()`, but actually saves the code to a file. :param filepath: The file to which the TikZ output will be written. From f473b48fb83a4fe794f5489a84c8b6d8e4760d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Thu, 30 Sep 2021 10:16:00 +0200 Subject: [PATCH 3/5] version bump --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index bb28cc73..7822daae 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = tikzplotlib -version = 0.9.12 +version = 0.9.13 author = Nico Schlömer author_email = nico.schloemer@gmail.com description = Convert matplotlib figures into TikZ/PGFPlots From d3c6b0ce0ad58a3c84c5eea7863b3c6b4abfc393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Thu, 30 Sep 2021 10:16:46 +0200 Subject: [PATCH 4/5] bump development status --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 7822daae..dd644aae 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,7 +14,7 @@ long_description_content_type = text/markdown license = MIT license_file = LICENSE classifiers = - Development Status :: 4 - Beta + Development Status :: 5 - Production/Stable Framework :: Matplotlib License :: OSI Approved :: MIT License Operating System :: OS Independent From 4cb7d20550931fd418c23ee378da3d26f704f956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Thu, 30 Sep 2021 10:18:35 +0200 Subject: [PATCH 5/5] remove support for 3.6 --- .github/workflows/ci.yml | 2 +- setup.cfg | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b82c9120..2527ba9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10-dev"] + python-version: ["3.7", "3.8", "3.9", "3.10-dev"] steps: - uses: actions/setup-python@v2 with: diff --git a/setup.cfg b/setup.cfg index dd644aae..d1f827a2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,7 +20,6 @@ classifiers = Operating System :: OS Independent Programming Language :: Python Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9