tikzplotlib icon indicating copy to clipboard operation
tikzplotlib copied to clipboard

Missing support for 'markevery' options in Line2D

Open Blubbaa opened this issue 3 years ago • 0 comments

Some options for markers in line plots are currently not supported, but would be nice to have.

According to the matplotlib docs, markevery can be an integer, tuple, slice, etc. but as far as i can see only the integer and explicit markers list is handled: https://github.com/nschloe/tikzplotlib/blob/8c5a097f7890fc03f8c4b39fe7664463ba66e1b4/src/tikzplotlib/_line2d.py#L152-L161

Using a tuple with (start, spacing) will simply be misinterpreted as explicit indices, using slices will even create an error.

For the tuple usecase, an easy solution could be:

elif isinstance(mark_every, tuple):
    addplot_options.append(f"mark repeat={mark_every[1]:d}")
    addplot_options.append(f"mark phase={mark_every[0]+1:d}")

Blubbaa avatar Nov 17 '21 00:11 Blubbaa