我想插入一些数据,并将结果绘制在对数刻度(pyplot.loglog)上。问题是,结果插值看起来非常奇怪,并且在对数尺度上绘制时显示不连续。插值对数缩放数据的最佳方法是什么?
pyplot.loglog(x, y, '+')
pyplot.hold(True)
s = scipy.interpolate.InterpolatedUnivariateSpline(x, y)
xs = numpy.logspace(numpy.log10(numpy.min(x)), numpy.log10(numpy.max(x)))
pyplot.loglog(xs, s(xs)) # This looks very strange because of the log scale!实际上,我通过插值数据的对数成功地做到了这一点,但我想知道是否有更简单的方法来实现同样的结果?
pyplot.loglog(x, y, '+')
pyplot.hold(True)
s = scipy.interpolate.InterpolatedUnivariateSpline(numpy.log10(x), numpy.log10(y))
xs = numpy.logspace(numpy.log10(numpy.min(x)), numpy.log10(numpy.max(x)))
pyplot.loglog(xs, numpy.power(10, s(numpy.log10(xs)))发布于 2012-05-10 23:04:29
看起来像是先取数据的对数,然后再拟合是一种正常的方法。参见Fitting a Power Law Distribution。
https://stackoverflow.com/questions/10536322
复制相似问题