17
17
def get_tikz_code (
18
18
figure = "gcf" ,
19
19
filepath = None ,
20
- figurewidth = None ,
21
- figureheight = None ,
20
+ axis_width = None ,
21
+ axis_height = None ,
22
22
textsize = 10.0 ,
23
23
tex_relative_path_to_data = None ,
24
24
externalize_tables = False ,
@@ -41,63 +41,57 @@ def get_tikz_code(
41
41
42
42
:param figure: either a Figure object or 'gcf' (default).
43
43
44
- :param figurewidth: If not ``None``, this will be used as figure width
45
- within the TikZ/PGFPlots output. If ``figureheight``
46
- is not given, ``tikzplotlib`` will try to preserve
47
- the original width/height ratio.
48
- Note that ``figurewidth`` can be a string literal,
49
- such as ``'\\ figurewidth'``.
50
- :type figurewidth: str
51
-
52
- :param figureheight: If not ``None``, this will be used as figure height
53
- within the TikZ/PGFPlots output. If ``figurewidth`` is
54
- not given, ``tikzplotlib`` will try to preserve
55
- the original width/height ratio. Note that
56
- ``figurewidth`` can be a string literal, such as
57
- ``'\\ figureheight'``.
58
- :type figureheight: str
59
-
60
- :param textsize: The text size (in pt) that the target latex document is
61
- using. Default is 10.0.
44
+ :param axis_width: If not ``None``, this will be used as figure width within the
45
+ TikZ/PGFPlots output. If ``axis_height`` is not given,
46
+ ``tikzplotlib`` will try to preserve the original width/height
47
+ ratio. Note that ``axis_width`` can be a string literal, such as
48
+ ``'\\ axis_width'``.
49
+ :type axis_width: str
50
+
51
+ :param axis_height: If not ``None``, this will be used as figure height within the
52
+ TikZ/PGFPlots output. If ``axis_width`` is not given,
53
+ ``tikzplotlib`` will try to preserve the original width/height
54
+ ratio. Note that ``axis_width`` can be a string literal, such
55
+ as ``'\\ axis_height'``.
56
+ :type axis_height: str
57
+
58
+ :param textsize: The text size (in pt) that the target latex document is using.
59
+ Default is 10.0.
62
60
:type textsize: float
63
61
64
- :param tex_relative_path_to_data: In some cases, the TikZ file will have to
65
- refer to another file, e.g., a PNG for
66
- image plots. When ``\\ input`` into a
67
- regular LaTeX document, the additional
68
- file is looked for in a folder relative
69
- to the LaTeX file, not the TikZ file.
70
- This arguments optionally sets the
71
- relative path from the LaTeX file to the
72
- data.
62
+ :param tex_relative_path_to_data: In some cases, the TikZ file will have to refer to
63
+ another file, e.g., a PNG for image plots. When
64
+ ``\\ input`` into a regular LaTeX document, the
65
+ additional file is looked for in a folder relative
66
+ to the LaTeX file, not the TikZ file. This
67
+ arguments optionally sets the relative path from
68
+ the LaTeX file to the data.
73
69
:type tex_relative_path_to_data: str
74
70
75
- :param externalize_tables: Whether or not to externalize plot data tables
76
- into tsv files.
71
+ :param externalize_tables: Whether or not to externalize plot data tables into tsv
72
+ files.
77
73
:type externalize_tables: bool
78
74
79
- :param override_externals: Whether or not to override existing external
80
- files (such as tsv or images) with conflicting
81
- names (the alternative is to choose other
82
- names).
75
+ :param override_externals: Whether or not to override existing external files (such
76
+ as tsv or images) with conflicting names (the alternative
77
+ is to choose other names).
83
78
:type override_externals: bool
84
79
85
- :param strict: Whether or not to strictly stick to matplotlib's appearance.
86
- This influences, for example, whether tick marks are set
87
- exactly as in the matplotlib plot, or if TikZ/PGFPlots
88
- can decide where to put the ticks.
80
+ :param strict: Whether or not to strictly stick to matplotlib's appearance. This
81
+ influences, for example, whether tick marks are set exactly as in the
82
+ matplotlib plot, or if TikZ/PGFPlots can decide where to put the
83
+ ticks.
89
84
:type strict: bool
90
85
91
- :param wrap: Whether ``'\\ begin{tikzpicture}'`` and
92
- ``'\\ end{tikzpicture}'`` will be written. One might need to
93
- provide custom arguments to the environment (eg. scale= etc.).
94
- Default is ``True``.
86
+ :param wrap: Whether ``'\\ begin{tikzpicture}'`` and ``'\\ end{tikzpicture}'`` will be
87
+ written. One might need to provide custom arguments to the environment
88
+ (eg. scale= etc.). Default is ``True``.
95
89
:type wrap: bool
96
90
97
- :param add_axis_environment: Whether ``'\\ begin{axis}[...]'`` and
98
- ``' \\ end{axis}'`` will be written. One needs to
99
- set the environment in the document. If ``False``
100
- additionally sets ``wrap=False``. Default is ``True``.
91
+ :param add_axis_environment: Whether ``'\\ begin{axis}[...]'`` and ``' \\ end{axis}'``
92
+ will be written. One needs to set the environment in
93
+ the document. If ``False`` additionally sets
94
+ ``wrap=False``. Default is ``True``.
101
95
:type add_axis_environment: bool
102
96
103
97
:param extra_axis_parameters: Extra axis options to be passed (as a list or set)
@@ -144,8 +138,8 @@ def get_tikz_code(
144
138
if figure == "gcf" :
145
139
figure = plt .gcf ()
146
140
data = {}
147
- data ["fwidth " ] = figurewidth
148
- data ["fheight " ] = figureheight
141
+ data ["axis width " ] = axis_width
142
+ data ["axis height " ] = axis_height
149
143
data ["rel data path" ] = tex_relative_path_to_data
150
144
data ["externalize tables" ] = externalize_tables
151
145
data ["override externals" ] = override_externals
0 commit comments