import pandas as pd
from pyecharts import options as opts
from pyecharts.charts import Radar
df1=ts.get_hist_data('600132',start='2018-01-03',end='2018-01-03')#获取2018-01-03的600132股票数据
name=list(df1)#获取列名
v1=[list(df1.ix[0])]
df2=ts.get_hist_data('600132',start='2018-01-02',end='2018-01-02')#获取2018-01-02的600132股票数据
v2=[list(df2.ix[0])]
df=pd.concat([df1,df2],axis=0)
up=list(df.describe().ix['max']*1.1)#设置上限
c = (
Radar()
.add_schema(
schema=[
opts.RadarIndicatorItem(name=name[i], max_=up[i]) for i in range(len(name))
]
)
.add("2018-01-03", v1)
.add("2018-01-02", v2,color="#0004a1")
.set_series_opts(label_opts=opts.LabelOpts(is_show=False))
.set_global_opts(title_opts=opts.TitleOpts(title="Radar-基本示例"))
)
c.render_notebook()
import pandas as pd
from pyecharts import options as opts
from pyecharts.charts import Radar
df1=ts.get_hist_data('600132',start='2018-01-03',end='2018-01-03')#获取2018-01-03的600132股票数据
name=list(df1)#获取列名
v1=[list(df1.ix[0])]
df2=ts.get_hist_data('600132',start='2018-01-02',end='2018-01-02')#获取2018-01-02的600132股票数据
v2=[list(df2.ix[0])]
df=pd.concat([df1,df2],axis=0)
up=list(df.describe().ix['max']*1.1)#设置上限
c = (
Radar()
.add_schema(
schema=[
opts.RadarIndicatorItem(name=name[i], max_=up[i]) for i in range(len(name))
]
)
.add("2018-01-03", v1)
.add("2018-01-02", v2,color="#0004a1")
.set_series_opts(label_opts=opts.LabelOpts(is_show=False))
.set_global_opts(title_opts=opts.TitleOpts(title="Radar-基本示例"),
legend_opts=opts.LegendOpts(selected_mode="single"))
)
c.render_notebook()
来源:oschina
链接:https://my.oschina.net/u/3750423/blog/4283398