Skip to content

Commit fb8e9a6

Browse files
committed
changed extra parameters default value from set() to None
1 parent 99c417e commit fb8e9a6

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

matplotlib2tikz/save.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def get_tikz_code(
2626
tex_relative_path_to_data=None,
2727
strict=False,
2828
wrap=True,
29-
extra_axis_parameters=set(),
30-
extra_tikzpicture_parameters=set(),
29+
extra_axis_parameters=None,
30+
extra_tikzpicture_parameters=None,
3131
dpi=None,
3232
show_info=True
3333
):
@@ -84,13 +84,15 @@ def get_tikz_code(
8484
Default is ``True``.
8585
:type wrap: bool
8686
87-
:param extra_axis_parameters: Extra axis options to be passed (as a set) to pgfplots.
88-
Default is ``None``.
87+
:param extra_axis_parameters: Extra axis options to be passed (as a set)
88+
to pgfplots. Default is ``None``.
8989
:type extra_axis_parameters: a set of strings for the pfgplots axes.
9090
91-
:param extra_tikzpicture_parameters: Extra tikzpicture options to be passed (as a set) to pgfplots.
91+
:param extra_tikzpicture_parameters: Extra tikzpicture options to be passed
92+
(as a set) to pgfplots.
9293
93-
:type extra_tikzpicture_parameters: a set of strings for the pfgplots tikzpicture.
94+
:type extra_tikzpicture_parameters: a set of strings for the pfgplots
95+
tikzpicture.
9496
9597
:param dpi: The resolution in dots per inch of the rendered image in case
9698
of QuadMesh plots. If ``None`` it will default to the value
@@ -123,11 +125,14 @@ def get_tikz_code(
123125
data['font size'] = textsize
124126
data['custom colors'] = {}
125127
data['extra tikzpicture parameters'] = extra_tikzpicture_parameters
126-
data['extra axis options [base]'] = extra_axis_parameters.copy()
127128
# rectangle_legends is used to keep track of which rectangles have already
128129
# had \addlegendimage added. There should be only one \addlegenimage per
129130
# bar chart data series.
130131
data['rectangle_legends'] = set()
132+
if extra_axis_parameters:
133+
data['extra axis options [base]'] = extra_axis_parameters.copy()
134+
else:
135+
data['extra axis options [base]'] = set()
131136

132137
if dpi is None:
133138
savefig_dpi = mpl.rcParams['savefig.dpi']
@@ -155,8 +160,9 @@ def get_tikz_code(
155160
# write the contents
156161
if wrap:
157162
code += '\\begin{tikzpicture}\n\n'
158-
code += ',\n'.join(data['extra tikzpicture parameters'])
159-
code += '\n'
163+
if extra_tikzpicture_parameters:
164+
code += ',\n'.join(data['extra tikzpicture parameters'])
165+
code += '\n'
160166

161167
coldefs = _get_color_definitions(data)
162168
if coldefs:

0 commit comments

Comments
 (0)