Skip to content

Commit 8f45516

Browse files
committed
seperated parameter extra in extra_axis_opt and extra_picture_opt
1 parent d759c1c commit 8f45516

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

matplotlib2tikz/save.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def get_tikz_code(
2626
tex_relative_path_to_data=None,
2727
strict=False,
2828
wrap=True,
29-
extra=None,
29+
extra_axis_opt=None,
30+
extra_picture_opt=None,
3031
dpi=None,
3132
show_info=True
3233
):
@@ -83,9 +84,13 @@ def get_tikz_code(
8384
Default is ``True``.
8485
:type wrap: bool
8586
86-
:param extra: Extra axis options to be passed (as a set) to pgfplots.
87+
:param extra_axis_opt: Extra axis options to be passed (as a set) to pgfplots.
8788
Default is ``None``.
88-
:type extra: a set of strings for the pfgplots axes.
89+
:type extra_axis_opt: a set of strings for the pfgplots axes.
90+
91+
:param extra_picture_opt: Extra tikzpicture options to be passed (as a set) to pgfplots.
92+
Default is ``None``.
93+
:type extra_picture_opt: a set of strings for the pfgplots tikzpicture.
8994
9095
:param dpi: The resolution in dots per inch of the rendered image in case
9196
of QuadMesh plots. If ``None`` it will default to the value
@@ -121,11 +126,16 @@ def get_tikz_code(
121126
# had \addlegendimage added. There should be only one \addlegenimage per
122127
# bar chart data series.
123128
data['rectangle_legends'] = set()
124-
if extra:
125-
data['extra axis options [base]'] = extra.copy()
129+
if extra_axis_opt:
130+
data['extra axis options [base]'] = extra_axis_opt.copy()
126131
else:
127132
data['extra axis options [base]'] = set()
128133

134+
if extra_picture_opt:
135+
data['extra picture options'] = extra_picture_opt.copy()
136+
else:
137+
data['extra picture options'] = set()
138+
129139
if dpi is None:
130140
savefig_dpi = mpl.rcParams['savefig.dpi']
131141
if isinstance(savefig_dpi, int):
@@ -152,6 +162,9 @@ def get_tikz_code(
152162
# write the contents
153163
if wrap:
154164
code += '\\begin{tikzpicture}\n\n'
165+
for options in data['extra picture options']:
166+
code += options + ',\n'
167+
155168

156169
coldefs = _get_color_definitions(data)
157170
if coldefs:

0 commit comments

Comments
 (0)