|
| 1 | +from __future__ import annotations |
| 2 | + |
1 | 3 | import enum |
2 | 4 | import pathlib |
3 | 5 | import tempfile |
4 | 6 | import warnings |
5 | | -from typing import List, Optional, Set, Union |
6 | 7 |
|
7 | 8 | import matplotlib as mpl |
8 | 9 | import matplotlib.pyplot as plt |
|
17 | 18 |
|
18 | 19 | def get_tikz_code( |
19 | 20 | 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, |
23 | 24 | textsize: float = 10.0, |
24 | | - tex_relative_path_to_data: Optional[str] = None, |
| 25 | + tex_relative_path_to_data: str | None = None, |
25 | 26 | externalize_tables: bool = False, |
26 | 27 | override_externals: bool = False, |
27 | | - externals_search_path: Optional[str] = None, |
| 28 | + externals_search_path: str | None = None, |
28 | 29 | strict: bool = False, |
29 | 30 | wrap: bool = True, |
30 | 31 | add_axis_environment: bool = True, |
31 | | - extra_axis_parameters: Optional[Union[List, Set]] = None, |
| 32 | + extra_axis_parameters: list | set | None = None, |
32 | 33 | 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, |
36 | 37 | show_info: bool = False, |
37 | 38 | include_disclaimer: bool = True, |
38 | 39 | standalone: bool = False, |
@@ -246,9 +247,7 @@ def get_tikz_code( |
246 | 247 | return code |
247 | 248 |
|
248 | 249 |
|
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): |
252 | 251 | """Same as `get_tikz_code()`, but actually saves the code to a file. |
253 | 252 |
|
254 | 253 | :param filepath: The file to which the TikZ output will be written. |
|
0 commit comments