【发布时间】:2012-04-08 16:48:37
【问题描述】:
我有一个问题。
我使用 Matplotlib 绘制了一个图表,如下所示:
from matplotlib import pyplot
import numpy
from scipy.interpolate import spline
widths = numpy.array([0, 30, 60, 90, 120, 150, 180])
heights = numpy.array([26, 38.5, 59.5, 82.5, 120.5, 182.5, 319.5])
xnew = numpy.linspace(widths.min(),widths.max(),300)
heights_smooth = spline(widths,heights,xnew)
pyplot.plot(xnew,heights_smooth)
pyplot.show()
现在我想使用宽度值作为参数来查询高度值。我似乎无法找到如何做到这一点。请帮忙!提前致谢!
【问题讨论】:
标签: python numpy scipy matplotlib