我有一些名为group的数据集,我想将它们绘制在一个空的图形上。我的意思是当计算机读取新的数据集时,我的程序会将其添加到图形中
for groups in seconds_list:
group = f[(groups)][:]
i_data = group['real']
q_data = group['imag']
i_data = np.array(i_data, dtype=float64)
q_data = np.array(q_data, dtype=float64)
# 10.log(10.(I^2+Q^2)+1) then rotate array w/ np.rot90()
power_ch1 = np.rot90(np.array(np.log10(((np.add(np.square(np.abs(i_data[:, ::2])) , np.square(np.abs(q_data[:, ::2]))))*10)+1)*10 , dtype=float64))
print("Group: ", groups)
fig, ax = plt.subplots()
ax.set_xlim(0, 475*200)
ax.set_ylim(0, 3000)
tx, ty = my_list[i]
ax.imshow(power_ch1, cmap='viridis', interpolation='nearest', aspect='auto', extent = (tx, tx+200, ty, ty+2700))
i +=1
plt.tight_layout()
plt.show()
我正在使用这个代码,但我不能保存旧的绘图。我想在旧数据集旁边添加新数据集。我怎么做?我在matlab中使用hold on
,但是我找不到python的替代品
可以使用
matlab
样式而不是object
样式(通过执行fig, ax = plt.subplots()
来使用),如下例所示:输出
您可以找到有关
matplotlib
in this great book绘图功能的更多信息干杯
相关问题 更多 >
编程相关推荐