如何在matplotalib上以对数标度可视化值?

Sha*_*han 6 python numeric matplotlib

我有很小的差异,如... 0.000001.我想以对数标度对它们进行可视化.我想知道如何在matplotlib中做到这一点.

非常感谢

Cor*_*hin 17

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axis

只需添加关键字参数即可 log=True

或者,在一个例子中:

from matplotlib import pyplot
import math
pyplot.plot([x for x in range(100)],[math.exp(y) for y in range(100)] )
pyplot.xlabel('arbitrary')
pyplot.ylabel('arbitrary')
pyplot.title('arbitrary')

#pyplot.xscale('log')
pyplot.yscale('log')

pyplot.show()
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述