我想插入一些数据,并在对数刻度(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)))