【发布时间】:2014-01-18 23:45:48
【问题描述】:
我在网上找遍了这个非常简单的东西,但找不到。
我有一个 (x,y) 点的列表并想要绘制它们,原点在左下角,网格标记在每个轴上显示 0,1,2,3,4...,橙色点.我该怎么做?
【问题讨论】:
标签: python matplotlib plot
我在网上找遍了这个非常简单的东西,但找不到。
我有一个 (x,y) 点的列表并想要绘制它们,原点在左下角,网格标记在每个轴上显示 0,1,2,3,4...,橙色点.我该怎么做?
【问题讨论】:
标签: python matplotlib plot
相当基本,你应该看看 matplotlib 文档,examples 或 gallery 部分显示了很多不同的东西和生成它的代码。
import matplotlib.pyplot as plt
import numpy as np
#Random sample data
x = np.random.random_integers(0, 5, 10)
y = np.random.random_integers(0, 5, 10)
plt.scatter(x,y, c='orange')
plt.ylim([0, y.max()])
plt.xlim([0, x.max()])
plt.grid()
plt.show()
【讨论】: