Skip to content

Commit 0281746

Browse files
authoredSep 30, 2021
Merge pull request #515 from nschloe/3.10
support 3.10
2 parents cd503f8 + 4cb7d20 commit 0281746

File tree

4 files changed

+33
-30
lines changed

4 files changed

+33
-30
lines changed
 

‎.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
strategy:
2525
matrix:
26-
python-version: [3.6, 3.7, 3.8, 3.9]
26+
python-version: ["3.7", "3.8", "3.9", "3.10-dev"]
2727
steps:
2828
- uses: actions/setup-python@v2
2929
with:

‎README.md

+17-13
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ figures like
2626

2727
for native inclusion into LaTeX or ConTeXt documents.
2828

29-
The output of tikzplotlib is in
30-
[PGFPlots](https://github.com/pgf-tikz/pgfplots/), a TeX library that sits on
31-
top of [PGF/TikZ](https://en.wikipedia.org/wiki/PGF/TikZ) and describes graphs in terms
32-
of axes, data etc. Consequently, the output of tikzplotlib
29+
The output of tikzplotlib is in [PGFPlots](https://github.com/pgf-tikz/pgfplots/), a TeX
30+
library that sits on top of [PGF/TikZ](https://en.wikipedia.org/wiki/PGF/TikZ) and
31+
describes graphs in terms of axes, data etc. Consequently, the output of tikzplotlib
3332

3433
- retains more information,
3534
- can be more easily understood, and
@@ -58,14 +57,17 @@ import tikzplotlib
5857

5958
tikzplotlib.save("test.tex")
6059
```
60+
6161
<!--close the figure and reset defaults
6262
<!--pytest-codeblocks:cont-->
63+
6364
```python
6465
import matplotlib as mpl
6566

6667
plt.close()
6768
mpl.rcParams.update(mpl.rcParamsDefault)
6869
```
70+
6971
-->
7072
(see above) gives
7173

@@ -147,8 +149,8 @@ to install.
147149

148150
to store the TikZ file as `mytikz.tex`.
149151

150-
3. Add the contents of `mytikz.tex` into your TeX source code. A convenient way of
151-
doing so is via
152+
3. Add the contents of `mytikz.tex` into your TeX source code. A convenient way of doing
153+
so is via
152154

153155
```latex
154156
\input{/path/to/mytikz.tex}
@@ -189,7 +191,8 @@ to install.
189191
tikzplotlib.Flavors.context.preamble()
190192
```
191193

192-
4. Optional: clean up the figure before exporting to tikz using the `clean_figure` command.
194+
4. [Optional] Clean up the figure before exporting to tikz using the `clean_figure`
195+
command.
193196

194197
```python
195198
import matplotlib.pyplot as plt
@@ -212,16 +215,16 @@ to install.
212215

213216
### Contributing
214217

215-
If you experience bugs, would like to contribute, have nice examples of what
216-
tikzplotlib can do, or if you are just looking for more information, then please
217-
visit [tikzplotlib's GitHub page](https://github.com/nschloe/tikzplotlib).
218+
If you experience bugs, would like to contribute, have nice examples of what tikzplotlib
219+
can do, or if you are just looking for more information, then please visit
220+
[tikzplotlib's GitHub page](https://github.com/nschloe/tikzplotlib).
218221

219222
### Testing
220223

221224
tikzplotlib has automatic unit testing to make sure that the software doesn't
222225
accidentally get worse over time. In `test/`, a number of test cases are specified.
223-
Those run through tikzplotlib and compare the output with a previously stored
224-
reference TeX file.
226+
Those run through tikzplotlib and compare the output with a previously stored reference
227+
TeX file.
225228

226229
To run the tests, just check out this repository and type
227230

@@ -231,4 +234,5 @@ pytest
231234

232235
### License
233236

234-
tikzplotlib is published under the [MIT license](https://en.wikipedia.org/wiki/MIT_License).
237+
tikzplotlib is published under the [MIT
238+
license](https://en.wikipedia.org/wiki/MIT_License).

‎setup.cfg

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = tikzplotlib
3-
version = 0.9.12
3+
version = 0.9.13
44
author = Nico Schlömer
55
author_email = nico.schloemer@gmail.com
66
description = Convert matplotlib figures into TikZ/PGFPlots
@@ -14,16 +14,16 @@ long_description_content_type = text/markdown
1414
license = MIT
1515
license_file = LICENSE
1616
classifiers =
17-
Development Status :: 4 - Beta
17+
Development Status :: 5 - Production/Stable
1818
Framework :: Matplotlib
1919
License :: OSI Approved :: MIT License
2020
Operating System :: OS Independent
2121
Programming Language :: Python
2222
Programming Language :: Python :: 3
23-
Programming Language :: Python :: 3.6
2423
Programming Language :: Python :: 3.7
2524
Programming Language :: Python :: 3.8
2625
Programming Language :: Python :: 3.9
26+
Programming Language :: Python :: 3.10
2727
Topic :: Multimedia :: Graphics :: Graphics Conversion
2828
Topic :: Scientific/Engineering :: Visualization
2929
keywords =

‎src/tikzplotlib/_save.py

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
from __future__ import annotations
2+
13
import enum
24
import pathlib
35
import tempfile
46
import warnings
5-
from typing import List, Optional, Set, Union
67

78
import matplotlib as mpl
89
import matplotlib.pyplot as plt
@@ -17,22 +18,22 @@
1718

1819
def get_tikz_code(
1920
figure="gcf",
20-
filepath: Optional[Union[str, pathlib.Path]] = None,
21-
axis_width: Optional[str] = None,
22-
axis_height: Optional[str] = None,
21+
filepath: str | pathlib.Path | None = None,
22+
axis_width: str | None = None,
23+
axis_height: str | None = None,
2324
textsize: float = 10.0,
24-
tex_relative_path_to_data: Optional[str] = None,
25+
tex_relative_path_to_data: str | None = None,
2526
externalize_tables: bool = False,
2627
override_externals: bool = False,
27-
externals_search_path: Optional[str] = None,
28+
externals_search_path: str | None = None,
2829
strict: bool = False,
2930
wrap: bool = True,
3031
add_axis_environment: bool = True,
31-
extra_axis_parameters: Optional[Union[List, Set]] = None,
32+
extra_axis_parameters: list | set | None = None,
3233
extra_groupstyle_parameters: dict = {},
33-
extra_tikzpicture_parameters: Optional[Union[List, Set]] = None,
34-
extra_lines_start: Optional[Union[List, Set]] = None,
35-
dpi: Optional[int] = None,
34+
extra_tikzpicture_parameters: list | set | None = None,
35+
extra_lines_start: list | set | None = None,
36+
dpi: int | None = None,
3637
show_info: bool = False,
3738
include_disclaimer: bool = True,
3839
standalone: bool = False,
@@ -246,9 +247,7 @@ def get_tikz_code(
246247
return code
247248

248249

249-
def save(
250-
filepath: Union[str, pathlib.Path], *args, encoding: Optional[str] = None, **kwargs
251-
):
250+
def save(filepath: str | pathlib.Path, *args, encoding: str | None = None, **kwargs):
252251
"""Same as `get_tikz_code()`, but actually saves the code to a file.
253252
254253
:param filepath: The file to which the TikZ output will be written.

0 commit comments

Comments
 (0)
Failed to load comments.