หากต้องการลบป้ายกำกับทางด้านซ้ายในแผนภูมิวงกลม matplotlib เราสามารถทำตามขั้นตอนต่อไปนี้ -
-
สร้างรายการชั่วโมง กิจกรรม และสี
-
พล็อตแผนภูมิวงกลมโดยใช้ pie() วิธีการ
-
หากต้องการซ่อนป้ายกำกับทางด้านซ้ายใน matplotlib เราสามารถใช้ plt.ylabel("") ด้วยสตริงว่าง
ตัวอย่าง
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
hours = [8, 1, 11, 4]
activities = ['sleeping', 'exercise', 'studying', 'working']
colors = ["grey", "green", "orange", "blue"]
plt.pie(hours, labels=activities, colors=colors, autopct="%.2f")
plt.ylabel("")
plt.show() ผลลัพธ์
