-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBokeh Examples
156 lines (156 loc) · 4.28 KB
/
Bokeh Examples
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
{
"cells": [
{
"cell_type": "markdown",
"id": "af10d128",
"metadata": {
"papermill": {
"duration": 0.003091,
"end_time": "2024-05-11T13:44:29.139491",
"exception": false,
"start_time": "2024-05-11T13:44:29.136400",
"status": "completed"
},
"tags": []
},
"source": [
"# Bokeh\n",
"\n",
"Bokeh boosts python plot chats in various ways. For web output, there are two main method. The standalone which we show examples here. The other is Bokeh application which relies on Bokeh server.\n",
"\n",
"## HTML files"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "785ac639",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-11T13:44:29.146864Z",
"iopub.status.busy": "2024-05-11T13:44:29.146401Z",
"iopub.status.idle": "2024-05-11T13:44:31.109316Z",
"shell.execute_reply": "2024-05-11T13:44:31.107960Z"
},
"papermill": {
"duration": 1.970606,
"end_time": "2024-05-11T13:44:31.112769",
"exception": false,
"start_time": "2024-05-11T13:44:29.142163",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"from bokeh.plotting import figure, show\n",
"from bokeh.resources import CDN\n",
"from bokeh.embed import file_html\n",
"\n",
"plot = figure()\n",
"plot.circle([1,2], [3,4])\n",
"\n",
"html = file_html(plot, CDN, \"my plot\")\n",
"show(plot)\n"
]
},
{
"cell_type": "markdown",
"id": "77114fde",
"metadata": {
"papermill": {
"duration": 0.002581,
"end_time": "2024-05-11T13:44:31.118501",
"exception": false,
"start_time": "2024-05-11T13:44:31.115920",
"status": "completed"
},
"tags": []
},
"source": [
"## Bokeh Applications\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "ebaa8282",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-11T13:44:31.125799Z",
"iopub.status.busy": "2024-05-11T13:44:31.125251Z",
"iopub.status.idle": "2024-05-11T13:44:31.134943Z",
"shell.execute_reply": "2024-05-11T13:44:31.133650Z"
},
"papermill": {
"duration": 0.016322,
"end_time": "2024-05-11T13:44:31.137460",
"exception": false,
"start_time": "2024-05-11T13:44:31.121138",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'<script id=\"cdd4c2db-858d-4fbf-8131-9f04b76898ac\">\\n (function() {\\n const xhr = new XMLHttpRequest()\\n xhr.responseType = \\'blob\\';\\n xhr.open(\\'GET\\', \"https://demo.bokeh.org/sliders/autoload.js?bokeh-autoload-element=cdd4c2db-858d-4fbf-8131-9f04b76898ac&bokeh-app-path=/sliders&bokeh-absolute-url=https://demo.bokeh.org/sliders\", true);\\n xhr.onload = function (event) {\\n const script = document.createElement(\\'script\\');\\n const src = URL.createObjectURL(event.target.response);\\n script.src = src;\\n document.body.appendChild(script);\\n };\\n xhr.send();\\n })();\\n</script>'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from bokeh.embed import server_document\n",
"script = server_document(\"https://demo.bokeh.org/sliders\")\n",
"\n",
"script"
]
}
],
"metadata": {
"kaggle": {
"accelerator": "none",
"dataSources": [],
"dockerImageVersionId": 30698,
"isGpuEnabled": false,
"isInternetEnabled": true,
"language": "python",
"sourceType": "notebook"
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
},
"papermill": {
"default_parameters": {},
"duration": 6.740695,
"end_time": "2024-05-11T13:44:32.164826",
"environment_variables": {},
"exception": null,
"input_path": "__notebook__.ipynb",
"output_path": "__notebook__.ipynb",
"parameters": {},
"start_time": "2024-05-11T13:44:25.424131",
"version": "2.5.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}