diff --git a/pylatex/tikz.py b/pylatex/tikz.py index 98add4be..2e5570b2 100644 --- a/pylatex/tikz.py +++ b/pylatex/tikz.py @@ -505,7 +505,8 @@ def __init__(self, func=None, coordinates=None, error_bar=None, - options=None): + options=None, + append_options=False): """ Args ---- @@ -517,6 +518,9 @@ def __init__(self, A list of exact coordinates tat should be plotted. options: str, list or `~.Options` + append_options: bool + If the given options should be appended to the automatically + assigned TikZ cycle list. """ self.name = name @@ -524,6 +528,7 @@ def __init__(self, self.coordinates = coordinates self.error_bar = error_bar self.options = options + self.append_options = append_options super().__init__() @@ -535,7 +540,14 @@ def dumps(self): str """ - string = Command('addplot', options=self.options).dumps() + if not isinstance(self.append_options, bool): + raise TypeError( + 'argument "append_options" can only be of type bool') + elif not self.append_options: + command_string = 'addplot' + else: + command_string = 'addplot+' + string = Command(command_string, options=self.options).dumps() if self.coordinates is not None: string += ' coordinates {%\n' diff --git a/tests/test_args.py b/tests/test_args.py index 5d9696d1..d1342a82 100755 --- a/tests/test_args.py +++ b/tests/test_args.py @@ -204,7 +204,7 @@ def test_tikz(): repr(a) p = Plot(name=None, func=None, coordinates=None, error_bar=None, - options=None) + options=None, append_options=None) repr(p) opt = TikZOptions(None)