[英]axes are not displayed with add_axes
add_axes([0,0,1,1])
使坐標軸 position 從 canvas 的左下點開始,從而導致坐標軸在圖中的 canvas 之外。 您可以刪除add_axes
並嘗試plt.bar(langs,students)
代替。 完整代碼:
import matplotlib.pyplot as plt
fig = plt.figure()
langs = ['C', 'C++', 'Java', 'Python', 'PHP']
students = [23,17,35,29,12]
plt.bar(langs, students)
plt.ylim(0,35)
plt.show()
和圖
或者如果你想用ax
這么糟糕,你可以使用fig, ax = plt.figure()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.