Open roberthsu2003 opened 1 month ago
import matplotlib.pyplot as plt
labels = ['Nokia', 'Samsung', 'Apple', 'Lumia']
values = [20, 30, 45, 10]
explode = [0.3, 0, 0, 0]
colors = ['yellow', 'green', 'red', 'blue']
figure = plt.figure(figsize=(5, 5), dpi=200, facecolor='#ADD8E6')
axes = figure.add_subplot(1, 1, 1)
axes.pie(values,
labels=labels,
explode=explode,
colors=colors,
autopct='%.1f%%',
startangle=180,
shadow={'ox': -0.01, 'oy': -0.01})
plt.show()
import matplotlib.pyplot as plt
labels = ['Nokia', 'Samsung', 'Apple', 'Lumia']
values = [20, 30, 45, 10]
explode = (0.3, 0, 0, 0)
color = ['yellow', 'green', 'red', 'blue']
figure = plt.subplot()
figure.pie(values, labels=labels, explode=explode, autopct='%1.1f%%', shadow=True, startangle=180, colors=color)
plt.show()
import matplotlib.pyplot as plt
labels = ['Nokia', 'Samsung', 'Apple', 'Lumia']
values = [20, 30, 45, 10]
explode = [0.3, 0, 0, 0]
colors = ['yellow', 'green', 'red', 'blue']
figure = plt.figure(figsize=(5, 5), dpi=150, facecolor='#FAF4FF')
axes = figure.add_subplot(1, 1, 1)
axes.pie(values,labels=labels,explode=explode,colors=colors,autopct='%.1f%%',startangle=180,shadow={'ox': -0.01, 'oy': -0.01})
axes.set_title('Market Survey',color ='black')
plt.show()
#labels = 'Nokia', 'Samsung', 'Apple', 'Lumia'
#values = [20, 30, 45, 10]
import matplotlib.pyplot as plt
labels = 'Nokia', 'Samsung', 'Apple', 'Lumia'
values = [20, 30, 45, 10]
explode = [0.3, 0, 0, 0]
colors = ['yellow', 'green', 'red', 'blue']
figure = plt.figure(figsize=(5, 5), dpi=150, facecolor='#EEA9A9')
axes = figure.add_subplot(1, 1, 1)
axes.pie(values,labels=labels,explode=explode,colors=colors,autopct='%.1f%%',startangle=180,shadow={'ox': -0.01, 'oy': -0.01})
axes.set_title('Market Survey')
plt.show()
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=185,
explode=explode)
plt.show()
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)
figure = plt.figure(figsize=(5,5),dpi=150,)
axes = figure.add_subplot(1,1,1)
axes.pie(values,
labels=labels,
colors=colors,
autopct='%1.1f%%',
startangle=180,
explode=explode,
shadow=True)
plt.show()
import matplotlib.pyplot as plt
labels = ['Nokia', 'Samsung', 'Apple', 'Lumia']
values = [20, 30, 45, 10]
#繪圖
plt.figure(figsize=(8,5),dpi=250,facecolor='#EEA9A9') #畫布
plt.pie(values,labels=labels,autopct='%1.1f%%', startangle=180,explode=(0.1,0,0,0),colors=['#FFFF00','g','r','b'],
wedgeprops = {'edgecolor': 'black','linewidth': 1})
plt.title('Pie Chart of Values by cell phone brand')
plt.show()
import matplotlib.pyplot as plt
labels = ['Nokia', 'Samsung', 'Apple', 'Lumia']
values = [20, 30, 45, 10]
explode = (0.4, 0, 0, 0)
color = ['yellow','green','red','blue']
figure = plt.figure(figsize=[5,5],dpi=250,facecolor='#81C7D4')
axes = figure.add_subplot(1, 1, 1)
axes.pie(values, explode=explode, labels=labels, colors=color, autopct='%1.1f%%',shadow=True, startangle=180, wedgeprops = {'edgecolor': 'black','linewidth': 1})
plt.show()
參考的網址
https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.pie.html