import matplotlib.pyplot as plt
import numpy as np
x=["q","w","e","r","t","y"]#不變的依然是x表示標簽值
y=[4,6,7,6,3,9]
plt.barh(x,y,align="center",color="green",alpha=0.6,label="barh")
box=dict(fc="red",pad=2,alpha=0.4)
#給坐標軸的標簽加上文本框,就是使用bbox函數
plt.xlabel("xaxis",bbox=box)
plt.ylabel("ylabel",bbox=dict(fc="green",ec="black",pad=2,alpha=0.5))
plt.grid(True,color="red",ls="-.",axis="y")#axis表示值顯示哪個軸的虛線
plt.legend()
plt.show()