先上图:
代码如下:
import matplotlib.pyplot as plt
生成 150 个列表,每个列表包含250个 0 值
lf_container = [[[]for i in range(250)]for i in range(150)]
for i in range(150):
for j in range(250):
lf_container[i][j] = 0
path = r"*******数据\20180517120155148.js"
with open(path, “r”) as load_jsfile1:
load_list1 = load_jsfile1.readlines()
x_value = []
y_value = []
for i in load_list1: # 读取列表内的数组
# 去掉字符串中的无效字符
load_list2 = i.strip("[").strip("]").replace("]", “”)
load_list3 = load_list2.split(",")
counter = 0 # 初始化频率点计数
for j in load_list3[0:-4]:
k = int(float(j) + 130)
lf_container[k][counter] += 1 # 累计每个点达到的电平值次数
counter += 1