python数据可视化学习-饼状图
生活随笔
收集整理的這篇文章主要介紹了
python数据可视化学习-饼状图
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
import numpy as np import matplotlib.pyplot as plt labels ='A','B','C','D' fraces = [15,30,45,10] plt.pie(x=fraces,labels= labels) plt.show()?
橢圓變標準圓??plt.axes(aspect=1)
?
import numpy as np import matplotlib.pyplot as plt labels ='A','B','C','D' fraces = [15,30,45,10] plt.axes(aspect=1) plt.pie(x=fraces,labels= labels) plt.show()在圖上顯示所占份額autopct='%0f%%'
import numpy as np import matplotlib.pyplot as plt labels ='A','B','C','D' fraces = [15,30,45,10] plt.axes(aspect=1) plt.pie(x=fraces,labels= labels,autopct='%0f%%') plt.show()突出重點,分離某一塊explode= explode
import numpy as np import matplotlib.pyplot as plt labels ='A','B','C','D' fraces = [15,30,45,10] explode = [0,0.5,0,0] plt.axes(aspect=1) plt.pie(x=fraces,labels= labels,autopct='%0f%%',explode= explode) plt.show()實現立體感 有陰影?shadow=True
import numpy as np import matplotlib.pyplot as plt labels ='A','B','C','D' fraces = [15,30,45,10] explode = [0,0.1,0,0] plt.axes(aspect=1) plt.pie(x=fraces,labels= labels,autopct='%0f%%',explode= explode,shadow=True) plt.show()總結
以上是生活随笔為你收集整理的python数据可视化学习-饼状图的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 定状同从句
- 下一篇: 函数的单调性与曲线的凹凸性