using Matplotlib how to highlight one point in the final plot

女生的网名这么多〃 提交于 2020-01-12 13:01:09

问题


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 or shape.

How can this be done using python?


回答1:


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()


来源:https://stackoverflow.com/questions/41489543/using-matplotlib-how-to-highlight-one-point-in-the-final-plot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!