赞
踩
import matplotlib.pyplot as plt
import numpy as np
def plot_scatter(ref_info_dict, test_info_dict):
# 绘制散点图,ref横,test纵
plt.figure(figsize=(80, 48))
n = 0
# scatter_header_list = ['peak_insert_size', 'median_insert_size']
scatter_header_list = list(ref_info_dict.keys())
for header in scatter_header_list:
n += 1
plt.subplot(8, 10, n)
x = np.array(ref_info_dict[header])
y = np.array(test_info_dict[header])
max_line = max([max(x), max(y)])
min_line = min([min(x), min(y)])
plt.scatter(x, # 横坐标
y, # 纵坐标
c='red', # 点的颜色
label='function') # 标签 即为点代表的意思
plt.plot([min_line, max_line], [min_line, max_line], ls="--", c=".3")
plt.title(header)
plt.xlabel("old data")
plt.ylabel("new data")
# 3.展示图形
plt.legend() # 显示图例
plt.show() # 显示所绘图形
plt.savefig('tmp_scatter.jpg')
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。