7.雷达图+玫瑰图

雷达图+玫瑰图

import pandas as pd
import numpy as np
from pyecharts.charts import Radar
import pyecharts.options as opts
data1 = [81, 87,65, 78, 73]
data2 = [92, 76, 82, 63, 88]

雷达图

ind=['语文','数学','英语','科学','社会']
rii=[]
for i in ind:
    rii.append(opts.RadarIndicatorItem(i,max_=100))

r=(
    Radar()
    .add_schema(rii,center=['50%','55%'])
    .add('张大伟',[data1],color='blue',symbol='circle',areastyle_opts=opts.AreaStyleOpts(opacity=0.1))
    .add('李小荷',[data2],color='red',symbol='square',areastyle_opts=opts.AreaStyleOpts(opacity=0.1))
    .set_series_opts(label_opts=opts.LabelOpts(is_show=False))
    .set_global_opts(
        title_opts=opts.TitleOpts(title='成绩对比分析',pos_left='center'),
        legend_opts=opts.LegendOpts(pos_top=30)
    )
)
r.render_notebook()

在这里插入图片描述

玫瑰图

df = pd.read_csv("sales.csv",header = None)
data = df.iloc[:,[11,16]].groupby(11).sum()
from pyecharts.charts import Pie
from pyecharts.faker import Faker
import pyecharts.options as opts
x = list(data.index)
y = list(np.round(data[16], 2) )
pie=(
    Pie()
    .add("", list(zip(x, y)), radius=("0%", "90%"), center=("50%", "55%"), rosetype="area")
    .set_colors(["red", "orange",  "green", "cyan", "blue", "purple"]) 
    .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}销售额: {c}元,占{d}%"))
    .set_global_opts(
        title_opts=opts.TitleOpts(title="各地区销售额分析", subtitle="", pos_left="center"),
        legend_opts=opts.LegendOpts(orient="vertical", pos_top="10%", pos_left="0")
    )
)
pie.render_notebook()

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值