Skip to content

Commit

Permalink
Merge pull request #515 from nschloe/3.10
Browse files Browse the repository at this point in the history
support 3.10
  • Loading branch information
nschloe authored Sep 30, 2021
2 parents cd503f8 + 4cb7d20 commit 0281746
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9", "3.10-dev"]
steps:
- uses: actions/setup-python@v2
with:
Expand Down
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -58,14 +57,17 @@ import tikzplotlib

tikzplotlib.save("test.tex")
```

<!--close the figure and reset defaults
<!--pytest-codeblocks:cont-->

```python
import matplotlib as mpl

plt.close()
mpl.rcParams.update(mpl.rcParamsDefault)
```

-->
(see above) gives

Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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).
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = tikzplotlib
version = 0.9.12
version = 0.9.13
author = Nico Schlömer
author_email = [email protected]
description = Convert matplotlib figures into TikZ/PGFPlots
Expand All @@ -14,16 +14,16 @@ 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
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
Programming Language :: Python :: 3.10
Topic :: Multimedia :: Graphics :: Graphics Conversion
Topic :: Scientific/Engineering :: Visualization
keywords =
Expand Down
25 changes: 12 additions & 13 deletions src/tikzplotlib/_save.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 0281746

Please sign in to comment.