欧美成人午夜免费全部完,亚洲午夜福利精品久久,а√最新版在线天堂,另类亚洲综合区图片小说区,亚洲欧美日韩精品色xxx

千鋒扣丁學堂Python培訓之matplotlib繪制餅狀圖功能示例

2019-09-10 13:45:25 5250瀏覽

今天千鋒扣丁學堂Python培訓老師給大家分享一篇關(guān)于matplotlib繪制餅狀圖功能示例的詳細介紹,結(jié)合實例形式分析了Python使用matplotlib模塊進行數(shù)值運算與餅狀圖繪制相關(guān)操作技巧,下面我們一起來看一下吧。



一、代碼

import numpy as np
import matplotlib.pyplot as plt
#The slices will be ordered and plotted counter-clockwise.
labels ='Frogs','Hogs','Dogs','Logs'
sizes =[15,30,45,10]
colors =['yellowgreen','gold','#FF0000','lightcoral']
#使餅狀圖中第2片和第4片裂開
explode =(0,0.1,0,0.1)
fig = plt.figure()
ax = fig.gca()
ax.pie(np.random.random(4), explode=explode, labels=labels, colors=colors,
autopct='%1.1f%%', shadow=True, startangle=90,
radius=0.25, center=(0,0), frame=True)
ax.pie(np.random.random(4), explode=explode, labels=labels, colors=colors,
autopct='%1.1f%%', shadow=True, startangle=90,
radius=0.25, center=(1,1), frame=True)
ax.pie(np.random.random(4), explode=explode, labels=labels, colors=colors,
autopct='%1.1f%%', shadow=True, startangle=90,
radius=0.25, center=(0,1), frame=True)
ax.pie(np.random.random(4), explode=explode, labels=labels, colors=colors,
autopct='%1.1f%%', shadow=True, startangle=90,
radius=0.25, center=(1,0), frame=True)
#設置坐標軸刻度
ax.set_xticks([0,1])
ax.set_yticks([0,1])
#設置坐標軸刻度上顯示的標簽
ax.set_xticklabels(["Sunny","Cloudy"])
ax.set_yticklabels(["Dry","Rainy"])
#設置坐標軸跨度
ax.set_xlim((-0.5,1.5))
ax.set_ylim((-0.5,1.5))
#設置縱橫比相等
ax.set_aspect('equal')
plt.show()

二、運行結(jié)果


以上就是關(guān)于千鋒扣丁學堂Python培訓之matplotlib繪制餅狀圖功能示例的全部內(nèi)容,想要了解更多關(guān)于Python和人工智能方面內(nèi)容的小伙伴,請關(guān)注扣丁學堂Python培訓官網(wǎng)、微信等平臺,扣丁學堂IT職業(yè)在線學習教育平臺為您提供權(quán)威的Python開發(fā)環(huán)境搭建視頻,Python培訓后的前景無限,行業(yè)薪資和未來的發(fā)展會越來越好的,扣丁學堂老師精心推出的Python視頻教程定能讓你快速掌握Python從入門到精通開發(fā)實戰(zhàn)技能??鄱W堂Python技術(shù)交流群:279521237。


扣丁學堂微信公眾號                          Python全棧開發(fā)爬蟲人工智能機器學習數(shù)據(jù)分析免費公開課直播間


      【關(guān)注微信公眾號獲取更多學習資料】         【掃碼進入Python全棧開發(fā)免費公開課】



查看更多關(guān)于"Python開發(fā)資訊"的相關(guān)文章>

標簽: Python培訓 Python視頻教程 Python在線視頻 Python學習視頻 Python培訓班

熱門專區(qū)

暫無熱門資訊

課程推薦

微信
微博
15311698296

全國免費咨詢熱線

郵箱:codingke@1000phone.com

官方群:148715490

北京千鋒互聯(lián)科技有限公司版權(quán)所有   北京市海淀區(qū)寶盛北里西區(qū)28號中關(guān)村智誠科創(chuàng)大廈4層
京ICP備2021002079號-2   Copyright ? 2017 - 2022
返回頂部 返回頂部