Skip to content

Commit a2635f3

Browse files
author
Lukas Maxeiner
committed
Added functionality for plotting step plots using plt.step() into draw_line2d function.
1 parent 33027dc commit a2635f3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tikzplotlib/line2d.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ def draw_line2d(data, obj):
3131
data, line_xcolor, _ = mycol.mpl_color2xcolor(data, color)
3232
addplot_options.append(line_xcolor)
3333

34+
# get draw style
35+
drawstyle = obj.get_drawstyle()
36+
if drawstyle is not (None or "default"):
37+
if drawstyle == "steps-mid":
38+
style = "const plot mark mid"
39+
elif drawstyle == "steps-pre" or drawstyle == "steps":
40+
style = "const plot mark left"
41+
elif drawstyle == "steps-post":
42+
style = "const plot mark right"
43+
addplot_options.append("{}".format(style))
44+
3445
alpha = obj.get_alpha()
3546
if alpha is not None:
3647
addplot_options.append("opacity={}".format(alpha))

0 commit comments

Comments
 (0)