using Matplotlib how to highlight one point in the final plot

前端 未结 1 405
日久生厌
日久生厌 2021-02-02 13:07

Suppose, I have x = [1,2,3,4,5,6] and the corresponding y = [3,4,5,6,7,8].

I want the first pair (1,3) to be in a different color

相关标签:
1条回答
  • 2021-02-02 13:51

    One of the simplest possible answers.

    import matplotlib.pyplot as plt
    
    x = [1,2,3,4,5,6]
    y = [3,4,5,6,7,8]
    
    plt.plot(x[1:], y[1:], 'ro')
    plt.plot(x[0], y[0], 'g*')
    
    plt.show()
    
    0 讨论(0)
提交回复
热议问题