Commit 1363362d by songxinkai

plot add text

parent 339b71e6
......@@ -165,7 +165,7 @@ if True:
z_count = [res['z'][0]] + [res['z'][2**i] for i in range(9)]
all_count = [res['all'][0]] + [res['all'][2**i] for i in range(9)]
x = np.arange(len(idx))
width = 0.2
width = 0.23
plt.bar(x-width/2, h_count, label='H', alpha=0.6, width=width)
plt.bar(x-3*width/2, w_count, label='W', alpha=0.6, width=width)
plt.bar(x+width/2, z_count, label='Z', alpha=0.6, width=width)
......@@ -179,8 +179,11 @@ if True:
print (idx)
print (h_count)
plt.xticks(x,idx)
# for i in range(len(idx)):
# plt.text(i-0.4, count[i]+0.02,"%.3f"%count[i],va='center')
for i in range(len(idx)):
plt.text(i-width/2-0.1, h_count[i]+0.01,"%.1f"%(100.*h_count[i]),va='center', fontsize=8)
plt.text(i-3*width/2-0.1, w_count[i]+0.01,"%.1f"%(100.*w_count[i]),va='center', fontsize=8)
plt.text(i+width/2-0.1, z_count[i]+0.01,"%.1f"%(100.*z_count[i]),va='center', fontsize=8)
plt.text(i+3*width/2-0.1, all_count[i]+0.01,"%.1f"%(100.*all_count[i]),va='center', fontsize=8)
# plt.title('Density')
plt.tight_layout()
plt.show()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment