简体   繁体   中英

using Matplotlib how to highlight one point in the final plot

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM