python中Matplotlib模块可以方便绘制制作折线图、柱状图、散点图等高质量的数据包。以下记录柱状图的做法。
import matplotlib.pyplot as plt
x=[1,2,3,4,5,6,7,8,9,10,11,12]# 确定柱状图数量,可以认为是x方向刻度
y=[0.469793862,-0.033904094,0.061834023,-0.265708377,-0.319787209,-0.18839667,0.153613325,0.202663755,0.575862852,-0.341525614,-0.199632651,-0.114813202]# y方向刻度
color=['blue','blue','blue','red','red','red','Magenta','Magenta','Magenta','orange','orange','orange']
x_label=['BL3','BL4','BL5','RL1','RL2','RL4','RB1','RB4','RB5','WL1','WL2','WL3']
plt.rcParams["font.sans-serif"]=['Times New Roman']#字体设置
plt.rcParams["axes.unicode_minus"]=False
plt.xticks(x, x_label) # 绘制x刻度标签
plt.bar(x, y,color=color)
plt.title("GM15")
plt.ylabel("Eigengene expression")
plt.savefig('GM15.png',dpi=600)#输出高帧率图形
出图
网友评论