Plotting a list of (x, y) coordinates in python matplotlib

后端 未结 3 457
忘掉有多难
忘掉有多难 2020-12-12 12:05

I have a list of pairs (a, b) that I would like to plot with matplotlib in python as actual x-y coordinates. Currently, it is making two plots, whe

3条回答
  •  清歌不尽
    2020-12-12 12:34

    If you want to plot a single line connecting all the points in the list

    plt.plot(li[:])
    
    plt.show()
    

    This will plot a line connecting all the pairs in the list as points on a Cartesian plane from the starting of the list to the end. I hope that this is what you wanted.

提交回复
热议问题