【Matplotlib绘制不等距直方图】 | 您所在的位置:网站首页 › 不等距直方图的绘制方法是什么意思呀 › 【Matplotlib绘制不等距直方图】 |
导入所需的库
import numpy as np
from matplotlib import pyplot as plt
生成数据
runtime_data = np.array([8.1, 7.0, 7.3, 7.2, 6.2, 6.1, 8.3, 6.4, 7.1, 7.0, 7.5, 7.8, 7.9, 7.0])
计算最大和最小运行时间
从runtime_data数组中找出最大和最小值。 max_runtime = runtime_data.max() min_runtime = runtime_data.min() print("最小运行时间:", min_runtime) print("最大运行时间:", max_runtime) 选择不等宽的组距在本例中,我们将选择不等宽的组距。手动创建一个包含组距边界的列表。 num_bin_list = [1.9, 3.5] # 初始组距边界 # 生成额外的组距边界,直到达到最大运行时间 i = 3.5 while i |
CopyRight 2018-2019 实验室设备网 版权所有 |