如何从 python 中的 matplotlib 散点图中提取数值数据?
数据挖掘
Python
matplotlib
海运
2022-02-23 05:16:21
1个回答
您还可以使用 matplotlibs annotate命令显示每个点的值:
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(5)
y = np.random.randint(10, size=5)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_ylim(0,10)
plt.plot(x,y)
for i,j in zip(x,y):
# xytext and textcoords are used to offset the labels
ax.annotate("({},{})".format(i, j), xy=(i, j), xytext=(5, 5), textcoords='offset')
plt.show()
其它你可能感兴趣的问题

