pandas 扩展 pandex,绘制楔形图

import pandas as pd
import pandex
import urllib.request
import matplotlib.pyplot as plt

plt.rcParams['font.sans-serif'] = ['SimHei']

data_dic = {
    'data1': [1,3,4],
    'data2': [5,6,7],
    'data3': [3,6,8],
    'data4': [6,7,9],
    'data5': [2,5,8],
}

df = pd.DataFrame(data_dic)

df.index = ['a','b','c']

fig = df.ext.wedge_plot(
    startangle=0,
    all_slices_percent=0.30,

    alpha=0.5,

    hide_ring_label=True,
    slice_label_rotate=True,

    legend_fontstyle='italic',
    legend_fontweight='normal',

    # legend_units=['titles', 'cups', 'titles', 'cups', 'titles'],

    explode=0.01,

    # 标题名称,相对位置
    title='楔形图',
    title_y=0.95,
    title_x=0.15,

    # 中心名称及中心大小
    circle_label='Hany博客',
    circle_fontsize=15,

    legend_y_start= 1
)

fig.savefig('楔形图.png')

 

 


https://mp.weixin.qq.com/s/19NcW3QH3KxqmIByLbtCBg

posted @ 2022-04-01 21:16  Hany47315  阅读(315)  评论(0编辑  收藏  举报