roberthsu2003 / __2024_07_01_Shilin_python__

士林python ai 初階
Apache License 2.0
13 stars 2 forks source link

請畫圓形圖表 #13

Open roberthsu2003 opened 3 months ago

roberthsu2003 commented 3 months ago
import matplotlib.pyplot as plt
labels = ['Nokia', 'Samsung', 'Apple', 'Lumia']
values = [20, 30, 45, 10]
colors =['yellow', 'green', 'red', 'blue']

截圖 2024-08-02 下午3 23 36

Marcoke999 commented 3 months ago
import matplotlib.pyplot as plt
labels = ['Nokia', 'Samsung', 'Apple', 'Lumia']
values = [20, 30, 45, 10]
colors =['yellow', 'green', 'red', 'blue']
explode = [0.3, 0, 0, 0]
plt.pie(values, labels=labels, colors=colors, autopct='%1.1f%%', startangle=180,explode=explode)
plt.axis('equal')  
plt.show()
Bowei0204 commented 3 months ago
import matplotlib.pyplot as plt

labels = ['Nokia', 'Samsung', 'Apple', 'Lumia']
values = [20, 30, 45, 10]
colors = ['yellow', 'green', 'red', 'blue'] 

figure = plt.figure()
axes = figure.add_subplot()
axes.pie(values, labels=labels, colors=colors, explode=(0.3,0,0,0), autopct='%1.1f%%',shadow=True, startangle=180)

plt.show()
sp11055422 commented 3 months ago
import matplotlib.pyplot as plt
labels = ['Nokia', 'Samsung', 'Apple', 'Lumia']
values = [20, 30, 45, 10]
fig, ax = plt.subplots()
ax.pie(values, labels=labels,autopct='%1.1f%%',colors=['yellow', 'green', 'red', 'blue'])
plt.show()
pinganko commented 3 months ago
import matplotlib.pyplot as plt
labels = ['Nokia', 'Samsung', 'Apple', 'Lumia']
values = [20, 30, 45, 10]
colors =['yellow', 'green', 'red', 'blue']
explode = (0, 0.1, 0, 0)  

fig, ax = plt.subplots()
ax.pie(values, explode=explode, labels=labels, autopct='%1.1f%%',
       shadow=True, startangle=90)
plt.show()
yi372 commented 2 months ago

import matplotlib.pyplot as plt
labels = ['Nokia', 'Samsung', 'Apple', 'Lumia']
values = [20, 30, 45, 10]
explode = [0.1,0,0,0]
fig, ax = plt.subplots()
ax.pie(values, explode=explode, labels=labels, autopct='%1.1f%%',
       shadow=True, startangle=90,colors =['yellow', 'green', 'red', 'blue'])
plt.show()
Sherry-gfsm commented 2 months ago

labels = ['Nokia', 'Samsung', 'Apple', 'Lumia']
values = [20, 30, 45, 10]
explode = [0.1,0,0,0]
fig, ax = plt.subplots()
ax.pie(values, explode=explode, labels=labels, autopct='%1.1f%%',
       shadow=True, startangle=90,colors =['yellow', 'green', 'red', 'blue'])
plt.show()```