所以我一直转圈圈在这最后一天了,希望有人可以把我赶出痛苦。matplotlib:绘制二维数组
我有一个函数f依赖于x和y的值,并在绘图˚F对Y,给出了以下figure。
现在每行的是对于x [0,1]的值和感觉,必须有一种方法来颜色/轮廓绘图,使得其可以很容易地鉴定出的线对应于x的什么值。我尝试了大量搜索,但在这种情况下没有找到任何有用的帮助。
的代码重现,让我的身材是如下数据。任何帮助都会很棒,因为我觉得我错过了一些显而易见的东西。
import numpy as np
import matplotlib.pyplot as plt
y = np.linspace(0,100)
x = np.linspace(0,1,11)
f = np.zeros((len(y), len(x)))
for j in range(len(x)):
i=0
for r in y:
f[i,j] = (1000 + (-r * 2)) + (1000*(1-x[j]))
i += 1
plt.plot(f, y)
怎么样一个[传奇](http://matplotlib.org/users/legend_guide.html)? – MKesper
http://stackoverflow.com/questions/16992038/inline-labels-in-matplotlib和http://matplotlib.org/users/legend_guide.html – Dadep
或者标绘在[3D](http://matplotlib.org/ mpl_toolkits/mplot3d/tutorial.html),或[注释](http://matplotlib.org/users/annotations_intro.html),或[colormapping线(http://stackoverflow.com/questions/8945699/gnuplot- linecolor-variable-in-matplotlib/18516488#18516488),或者如果只有非常有限的x个值,请使用不同的[linestyle](http://matplotlib.org/api/lines_api.html#matplotlib.lines。 Line2D.set_linestyle)。 – armatita