How to plot a multicolored curve using a single plot command in matplotlib

后端 未结 2 669
我在风中等你
我在风中等你 2021-01-21 06:30

If I understand correctly, the function:

matplotlib.pyplot.plot(x, y)

plots len(x)-1 separate line segments - one going from (x[0], y[0]) to (x

2条回答
  •  情书的邮戳
    2021-01-21 06:50

    You should be able to use matplotlib.collections.LineCollection which accepts a colors parameter (sequence of RGBA tuples).

提交回复
热议问题