使用Matplotlib如何在最终图中突出显示一个点 [英] using Matplotlib how to highlight one point in the final plot
本文介绍了使用Matplotlib如何在最终图中突出显示一个点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我有 x = [1,2,3,4,5,6]
和相应的 y = [3,4 ,5,6,7,8]
。
我要第一对(1,3)
为其他颜色或形状。
I want the first pair (1,3)
to be in a different color or shape.
如何使用python做到这一点?
How can this be done using python?
推荐答案
最简单的答案之一。
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()
这篇关于使用Matplotlib如何在最终图中突出显示一个点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文