可以看到,尺寸约为250微米^ 2的孔具有最高的频率,因此存在于微观结构中的可能性最高。
谁能告诉我如何从中获得概率直方图,因为我需要使用Weibull分布函数并将曲线拟合为直方图。
我试图在代码中添加“ density = True”,但是我得到了:
这是我的代码:
import matplotlib.pyplot as plt
import scipy as sci
file1 = 'data_histogram.csv'
file2 = 'data_histogram_1.csv'
data_hist = sci.loadtxt(file1, delimiter=',')
data_hist_1 = sci.loadtxt(file2, delimiter=',')
bins = data_hist[:,0]
data_pores = data_hist_1[:]
plt.rcParams['font.family'] = 'Times New Roman'
fig1 = plt.figure(1, figsize=(9,8))
ax1 = fig1.add_subplot(1,1,1)
ax1.set_xlabel('Pore size', fontsize=14)
ax1.set_ylabel('Freqeuncy', fontsize=14)
ax1.tick_params(direction='out', size=9, width='1.3', labelsize=14)
ax1.hist(data_pores,bins=bins, density=True)
plt.savefig('figure_example1.jpg')
plt.show()enter code here