Mercurial > hg > Papers > 2021 > mk-thesis
view paper/file/benchmark/bar.py @ 47:25d968349699
update slide
author | Ken Miyahira <e175733@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 11 Feb 2021 23:48:04 +0900 |
parents | ae1309162772 |
children | 47a9b8bf069b |
line wrap: on
line source
import matplotlib.pyplot as plt import subprocess def getData(): x, y = [], [] print("データ読み込み") x = [1, 2, 3] label = ["Docker", "Podman", "ie-podman"] y = [758.16, 4999.47, 809.34] name = input("GraphName: ") xlabel = input("xlabel: ") ylabel = input("ylabel: ") xr = input("Xrange: ") xr = xr.split(" ") yr = input("Yrange: ") yr = yr.split(" ") # 画像出力 print("画像出力") plot_graph(name,x,y,float(xr[0]),float(xr[1]),float(yr[0]),float(yr[1]),xlabel,ylabel,label) return name def plot_graph(name,x,y,sx,ex,sy,ey,xlabel,ylabel,label): plt.xlim(sx,ex) plt.xlabel(str(xlabel)) plt.ylim(sy,ey) plt.ylabel(str(ylabel)) plt.bar(x, y, tick_label=label, align="center") #for i in range(len(x)): # plt.plot(x[i],y[i], label=FILES[i].split("/")[-1])#markersize=0.5) #plt.legend() plt.savefig("./pdf/"+str(name)+".pdf") plt.delaxes() def openGraph(name): cmd = ["open", "./pdf/"+str(name)+".pdf"] subprocess.check_call(cmd) if __name__ == "__main__": name = getData() if(input("画像を表示しますか(Y or N): ")=="y"): openGraph(name)