Python中的日志比例mathplotlib?

Python中的日志比例mathplotlib?,python,graph,matplotlib,scale,natural-logarithm,Python,Graph,Matplotlib,Scale,Natural Logarithm,我正在尝试拟合对数正态曲线,但我不确定如何将y轴(和x轴)更改为对数比例? 我尝试使用logspace而不是linspace,但出现了一个错误 OverflowError: cannot convert float infinity to integer 我试过: x = np.linspace(np.log(min(bins)),np.log(max(bins)),10000) 但这似乎也不起作用。我附上我的图表来告诉你我的意思。我真的看不到在400左右发生了什么,所以我想记录y的比例

我正在尝试拟合对数正态曲线,但我不确定如何将y轴(和x轴)更改为对数比例? 我尝试使用logspace而不是linspace,但出现了一个错误

 OverflowError: cannot convert float infinity to integer
我试过:

 x = np.linspace(np.log(min(bins)),np.log(max(bins)),10000)
但这似乎也不起作用。我附上我的图表来告诉你我的意思。我真的看不到在400左右发生了什么,所以我想记录y的比例(同时记录x的比例以进行比较)

from collections import Counter
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from scipy.stats import lognorm
import numpy as np

data = list(pre_data)
params = (0.40951093774076597, 5.1802137214177684, 60.158303995566413)
shape, loc, scale = params[0], params[1], params[2]
print params
prob = 1-lognorm.cdf(388,shape,loc=params[1], scale=params[2])
print prob * 2994
count, bins, ignored = plt.hist(data,100,normed=True)

mu = np.mean(np.log(data))
sigma = np.std(np.log(data))
x = np.linspace(min(bins),max(bins),10000)
pdf = (np.exp(-(np.log(x)-mu)**2 / (2 * sigma**2)) / (x * sigma * np.sqrt(2*np.pi)))
plt.plot(x,pdf,color='r',linewidth= 2)
plt.xscale('log')
plt.yscale('log')