Use Line2D to plot line in python

后端 未结 3 1480
予麋鹿
予麋鹿 2021-01-02 10:08

I have the data:

x = [10,24,23,23,3]
y = [12,2,3,4,2]

I want to plot it using

matplotlib.lines.Line2D(xdata, ydata)

I use

3条回答
  •  借酒劲吻你
    2021-01-02 10:28

    The more common approach (not exactly what the questioner asked) is to use the plot interface. This involves Line2D behind the scenes.

    >>> x = [10,24,23,23,3]
    >>> y = [12,2,3,4,2]
    >>> import matplotlib.pyplot as plt
    >>> plt.plot(x,y)
    []
    >>> plt.show()
    

提交回复
热议问题