代碼如下:
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(10,6))
x = [1,2,3,4,5,6]
y = [10,12,33,45,67,89]
plt.bar(x,y)
for x,y in zip(x,y):
plt.text(x+0.02,y+1,y,ha='center',va='bottom')
plt.xticks(())
plt.yticks(())
結果如下:
代碼如下:
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(10,6))
x = [1,2,3,4,5,6]
y = [10,12,33,45,67,89]
plt.bar(x,y)
for x,y in zip(x,y):
plt.text(x+0.02,y+1,y,ha='center',va='bottom')
plt.xticks(())
plt.yticks(())
結果如下: