You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Interactive data visualisation in Python :snake:
1
+
# Workshop: Interactive data visualisation in Python :snake:
3
2
4
3
## Instructor
5
4
Dr. Thomas Bury <br>
@@ -10,25 +9,44 @@ Contact: thomas.bury@mcgill.ca
10
9
## Summary
11
10
Modern scientific methods give rise to vast quantities of data. Creating effective visualisations is essential for both presentation and exploration of the data. This is no easy task when the data contains dozens of variables and millions of entries. Traditional visualisations are static, that is, what the user sees is what the user gets. Interactive visualisations allow the user to perform tasks such as varying parameters, honing in subsections of the data, and switching between different plot types, all without touching the code! This faciliates rapid exploration of the data. Moreover, these visulisations can be easily shared with collaborators who only require a web browser to open the visualisation.
12
11
13
-
This workshop will equip participants with the skills required to begin creating interactive visualisations in Python. The format will be interactive, with alternation between demonstrations by the instructor and participants working through their own Jupyter notebook (provided in advance). Participants will come away having made several of their own visualisations of either a large public dataset, or their own dataset if they would like to bring one. See this [interactive visualisation](https://ecg-dashboard-medium.herokuapp.com/) of ECG data from Physionet for an example of what can be achieved with these tools.
12
+
This workshop will equip participants with the skills required to begin creating interactive visualisations in Python, using the [Plotly](https://plotly.com/python/) library. The format will be interactive, with alternation between demonstrations by the instructor and participants working through their own Jupyter notebook (provided in advance). Participants will come away having made several of their own visualisations of either a large public dataset, or their own dataset if they would like to bring one. Check out this[interactive visualisation](https://ecg-dashboard-medium.herokuapp.com/) of ECG data from Physionet for an example of what can be achieved with these tools.
14
13
15
14
## Objectives
16
-
In this workshop, we will use the *pandas* library to manipulate dataframes, the *plotly* library to make interactive visualisations and the *dash* library to bring together the visualisations into a dashboard. Participants of the workshop will learn and implement the following techniques:
15
+
We will cover the following:
17
16
- Organisation of *pandas* DataFrames to facilitate rapid plotting.
18
-
- Use of basic Plotly functionality including the creation of different plot representations (Bar, Line, Scatter, Histogram) and exportation to html files for interactive viewing.
19
-
- Visualisation of higher-dimensional data with the use of multiple traces, grid plots and 3-dimensional plotting.
20
-
- Integration of sliders and drop-down boxes to interactively switch between different visualisations of the data.
21
-
- (If time allows.) Combining interactive plots into a dashboard with components connected by callback functions.
- Visualisation of multiple dimensions using multiple traces, grid plots and 3-dimensional graphs.
19
+
- Integration of sliders and drop-down boxes.
20
+
- (If time allows.) Combining interactive plots into a dashboard.
23
21
24
22
## Setup instructions
25
23
26
-
Python 3 and JupyterLab are required for the workshop. If these are already installed on your computer you may skip these steps.
27
-
1. Download the Anaconda distribution
28
-
2.
24
+
1. Install the Anaconda distribution available [here](https://www.anaconda.com/products/distribution). This comes with Python 3, JupyterLab and a large number of Python packages.
25
+
26
+
2. Install Python packages for *plotly* and *dash* by entering the following commands into your Terminal (Mac) or Command Prompt (PC):
3. Install [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) if not already on your computer.
34
+
35
+
4. Make a [Github](https://github.com/) account if you don't already have one.
36
+
37
+
5. Go to the workshop [repository](https://github.com/ThomasMBury/workshop_datavis_python), and create a *fork* (button on top right). This creates your own version of the repository, allowing you to make edits to the workshop notebooks.
38
+
39
+
6. *Clone* your repository to your computer. To do this, click the green button that says 'Code', and copy the link that appears in the box. Then go to your Terminal (or Command Prompt), navigate to a folder where you would like to store the repository and enter
40
+
41
+
```
42
+
git clone paste-your-link-here
43
+
```
44
+
45
+
You should now see the directory *workshop_datavis_python* saved on your computer.
46
+
47
+
7. Open the Anaconda Navigator and launch JupyterLab. Navigate to where you saved the workshop repository and open *test.ipynb*. You should be able to run this notebook without any errrors.
29
48
30
-
....finish this.....
49
+
If you run into issues, please contact me at thomas.bury@mcgil.ca.
31
50
32
-
If you run into issues, please contact the instructor for help.
Copy file name to clipboardExpand all lines: test.ipynb
+18-11Lines changed: 18 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -11,14 +11,14 @@
11
11
"cell_type": "markdown",
12
12
"metadata": {},
13
13
"source": [
14
-
"Hello everyone! If you're reading this you've successfully booted up a Jupyter notebook. We will be using Jupyter notebooks throughout the workshop so it's a good idea to familiarise yourself with them.\n",
14
+
"Hello everyone! If you're reading this you've successfully launched a Jupyter notebook. We will be using Jupyter notebooks throughout the workshop so it's a good idea to familiarise yourself with them.\n",
15
15
"\n",
16
16
"Below we are going to import the required Python libraries to check that they were installed successfully on your computer. Click the cell below and run it using either the 'play button' above or by pressing shift + enter."
17
17
]
18
18
},
19
19
{
20
20
"cell_type": "code",
21
-
"execution_count": 1,
21
+
"execution_count": 2,
22
22
"metadata": {},
23
23
"outputs": [],
24
24
"source": [
@@ -29,8 +29,8 @@
29
29
"import plotly.graph_objects as go\n",
30
30
"import dash\n",
31
31
"from jupyter_dash import JupyterDash\n",
32
-
"import dash_core_components as dcc\n",
33
-
"import dash_html_components as html\n",
32
+
"from dash import dcc\n",
33
+
"from dash import html\n",
34
34
"from dash.dependencies import Input, Output"
35
35
]
36
36
},
@@ -45,7 +45,7 @@
45
45
},
46
46
{
47
47
"cell_type": "code",
48
-
"execution_count": 2,
48
+
"execution_count": 3,
49
49
"metadata": {},
50
50
"outputs": [],
51
51
"source": [
@@ -55,7 +55,7 @@
55
55
},
56
56
{
57
57
"cell_type": "code",
58
-
"execution_count": 3,
58
+
"execution_count": 4,
59
59
"metadata": {},
60
60
"outputs": [
61
61
{
@@ -165,7 +165,7 @@
165
165
"59 32 "
166
166
]
167
167
},
168
-
"execution_count": 3,
168
+
"execution_count": 4,
169
169
"metadata": {},
170
170
"output_type": "execute_result"
171
171
}
@@ -176,7 +176,7 @@
176
176
},
177
177
{
178
178
"cell_type": "code",
179
-
"execution_count": 4,
179
+
"execution_count": 5,
180
180
"metadata": {},
181
181
"outputs": [],
182
182
"source": [
@@ -186,7 +186,7 @@
186
186
},
187
187
{
188
188
"cell_type": "code",
189
-
"execution_count": 5,
189
+
"execution_count": 6,
190
190
"metadata": {},
191
191
"outputs": [],
192
192
"source": [
@@ -199,11 +199,18 @@
199
199
"source": [
200
200
"After running the above cells, you should find a file named my_first_fig.html. Go ahead and open it, either in JupyterLab (click 'trust HTML') or in your web browser . You should see your first Plotly visualisation of the Gapminder dataset. Congrats and see you in the workshop!"
0 commit comments