-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtw.py
141 lines (140 loc) · 3.3 KB
/
tw.py
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import plotly.offline as pyo
from plotly.graph_objs import *
trace1 = {
"x": ["台北市", "新北市", "桃園市", "台中市", "高雄市", "彰化縣", "基隆市"],
"y": [95, 33, 34, 9, 2, 1, 1],
"marker": {"color": "rgb(248,118,109)"},
"name": "檢傷一級",
"showlegend": True,
"type": "bar",
"uid": "817a5d",
"xaxis": "x",
"yaxis": "y"
}
trace2 = {
"x": ["台北市", "新北市", "桃園市", "台中市", "高雄市", "彰化縣", "新竹市", "基隆市", "台南市", "嘉義縣", "嘉義市"],
"y": [118, 65, 15, 10, 6, 4, 4, 1, 4, 2, 1],
"marker": {"color": "rgb(163,165,0)"},
"name": "檢傷二級",
"showlegend": True,
"type": "bar",
"uid": "140c8d",
"xaxis": "x",
"yaxis": "y"
}
trace3 = {
"x": ["台北市", "新北市", "桃園市", "台中市", "彰化縣", "新竹市", "基隆市"],
"y": [45, 34, 15, 3, 2, 1, 1],
"marker": {"color": "rgb(0,191,125)"},
"name": "檢傷三級",
"showlegend": True,
"type": "bar",
"uid": "5375e8",
"xaxis": "x",
"yaxis": "y"
}
trace4 = {
"x": ["台北市", "新北市", "台中市", "新竹市", "基隆市"],
"y": [5, 8, 1, 6, 1],
"marker": {"color": "rgb(0,176,246)"},
"name": "檢傷四級",
"showlegend": True,
"type": "bar",
"uid": "869e37",
"xaxis": "x",
"yaxis": "y"
}
trace5 = {
"x": ["台北市"],
"y": [1],
"marker": {"color": "rgb(231,107,243)"},
"name": "檢傷五級",
"showlegend": True,
"type": "bar",
"uid": "286b75",
"xaxis": "x",
"yaxis": "y"
}
data = Data([trace1, trace2, trace3, trace4, trace5])
layout = {
"annotations": [
{
"x": 1.05,
"y": 0.52,
"showarrow": False,
"text": "<b>醫療檢傷</b>",
"textangle": 0,
"xanchor": "center",
"xref": "paper",
"yref": "paper"
}
],
"autosize": True,
"barmode": "stack",
"height": 583,
"legend": {
"x": 1.05,
"y": 0.5,
"bgcolor": "rgb(255,255,255)",
"bordercolor": "transparent",
"font": {"family": "STHeiti"},
"xanchor": "center",
"yanchor": "top"
},
"margin": {"r": 10},
"paper_bgcolor": "rgb(255,255,255)",
"plot_bgcolor": "rgb(229,229,229)",
"showlegend": True,
"titlefont": {"family": "STHeiti"},
"width": 936,
"xaxis": {
"autorange": True,
"gridcolor": "rgb(255,255,255)",
"range": [-0.5, 10.5],
"showgrid": True,
"showline": False,
"showticklabels": True,
"tickangle": 0,
"tickcolor": "rgb(127,127,127)",
"tickfont": {
"color": "rgb(127,127,127)",
"family": "STHeiti",
"size": 14.4
},
"ticks": "outside",
"title": "醫院縣市別",
"titlefont": {
"color": "rgb(0, 0, 0)",
"family": "STHeiti",
"size": 18
},
"type": "category",
"zeroline": False
},
"yaxis": {
"autorange": True,
"gridcolor": "rgb(255,255,255)",
"range": [0, 277.894736842],
"showgrid": True,
"showline": False,
"showticklabels": True,
"tickangle": 0,
"tickcolor": "rgb(127,127,127)",
"tickfont": {
"color": "rgb(127,127,127)",
"family": "STHeiti",
"size": 14.4
},
"ticks": "outside",
"title": "人數",
"titlefont": {
"color": "rgb(0, 0, 0)",
"family": "STHeiti",
"size": 18
},
"type": "linear",
"zeroline": False
}
}
fig = Figure(data=data, layout=layout)
plot_url = pyo.plot(fig)