久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術(shù)文章
文章詳情頁

python - matplotlib pie怎么設(shè)置alpha

瀏覽:138日期:2022-06-29 09:54:41

問題描述

matplotlib.pyplot.bar有alpha這個參數(shù)但在pie里好像使用是會報錯,自帶的顏色太丑了!求大神賜教!

問題解答

回答1:

因?yàn)闆]有代碼,不太清楚你的實(shí)際情況,不過下列有一些例子,是有設(shè)罝了alpha值

polar_bar_demo.py 使用 bar.set_alpha(...)

matplotlib.patches.Patch 使用 fc=(0, 0, 1, 0.5)基本上是找對象設(shè)alpha值如XXX.set_aplha()或傳參數(shù)定facecolor fc值時給四位tuple。

見代碼

# Pie chart, where the slices will be ordered and plotted counter-clockwise:labels = ’Frogs’, ’Hogs’, ’Dogs’, ’Logs’sizes = [15, 30, 45, 10]explode = (0, 0.1, 0, 0) # only 'explode' the 2nd slice (i.e. ’Hogs’)fig1, ax1 = plt.subplots()patches, texts, autotexts = ax1.pie(sizes, explode=explode, labels=labels, autopct=’%1.1f%%’,shadow=True, startangle=90)for i, p in enumerate(patches): p.set_alpha(0.25*i)plt.show()

patches/wedges set_alpha就可以了。

更多範(fàn)例見:Wedge

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 申扎县| 洪湖市| 茌平县| 嘉禾县| 江西省| 万安县| 康平县| 林口县| 阿巴嘎旗| 泸西县| 蒙阴县| 北京市| 罗田县| 潞城市| 翁源县| 鸡泽县| 厦门市| 平度市| 噶尔县| 开封市| 德庆县| 恩施市| 黑水县| 福泉市| 格尔木市| 正镶白旗| 无极县| 河津市| 曲松县| 类乌齐县| 绥宁县| 闵行区| 普兰店市| 临城县| 江陵县| 秦皇岛市| 神木县| 云和县| 青龙| 鄄城县| 长阳|