-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtu1.py
More file actions
53 lines (42 loc) · 1.26 KB
/
tu1.py
File metadata and controls
53 lines (42 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -*- coding: utf-8 -*-
import plotly as py
import plotly.graph_objs as go
pyplt = py.offline.plot
# Stacked Bar Chart
trace_1 = go.Bar(
x = ['深证50', '上证50', '西南50', '西北50','华中50'],
y = [0.7252, 0.9912, 0.5347, 0.4436, 0.9911],
name = '股票投资'
)
trace_2 = go.Bar(
x = ['深证50', '上证50', '西南50', '西北50','华中50'],
y = [0.2072, 0, 0.4081, 0.4955, 0.02],
name='其它投资'
)
trace_3 = go.Bar(
x = ['深证50', '上证50', '西南50', '西北50','华中50'],
y = [0, 0, 0.037, 0, 0],
name='债券投资'
)
trace_4 = go.Bar(
x = ['深证50', '上证50', '西南50', '西北50','华中50'],
y = [0.0676, 0.0087, 0.0202, 0.0609, 0.0087],
name='银行存款'
)
trace_5 = go.Bar(
x = ['深证50', '上证50', '西南50', '西北50','华中50'],
y = [0.2, 0.3, 0.037, 0, 0.2],
name='债券投资'
)
trace_6 = go.Bar(
x = ['深证50', '上证50', '西南50', '西北50','华中50'],
y = [0.0676, 0.0387, 0.0202, 0.0609, 0.0287],
name='银行存款'
)
trace = [trace_1, trace_2, trace_3, trace_4, trace_5, trace_6]
layout = go.Layout(
title = '基金资产配置比例图',
barmode='stack'
)
fig = go.Figure(data = trace, layout = layout)
pyplt(fig, filename='1.html')