Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 17 additions & 40 deletions content/en/modules/python_visualization/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type: "modules" # DON'T TOUCH THIS ! :)
title: "Introduction to data visualization in Python"

# Your project GitHub repository URL
github_repo:
github_repo: https://github.com/school-brainhack/module_python_visualization

# If you are working on a project that has website, indicate the full url including "https://" below or leave it empty.
website:
Expand Down Expand Up @@ -36,64 +36,41 @@ If you have any questions regarding the module content please ask them in the re
to the server and would like to join, please send us an email at school [dot] brainhack [at] gmail [dot] com.

## Resources

This module is built around one Jupyter notebook and one set of exercises, all available in the [module repository](https://github.com/school-brainhack/module_python_visualization).

## Original lecture
This module was presented by Jacob Vogel during the QLSC 612 course in 2020, and the associated notebook is available [here](https://github.com/neurodatascience/course-materials-2020/blob/master/lectures/14-may/01-data-visualization/python_visualization_for_data.ipynb). (Note: if you did the BIDS module, the dataset to download is the same - ds000228! A few functions now throw warnings, you can ignore these, or fix them if you like.)

The video of the presentation is available below (1h09):
<iframe width="560" height="315" src="https://www.youtube.com/embed/lJyFWTT7sCY" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

## Tutorial

* Download the jupyter notebook (save raw version from Github), or start a new jupyter notebook
* Watch the video and run the cells in the notebook

## Exercice

For this next part, we will refer to the following [notebook](https://github.com/brainhackorg/school/blob/master/content/en/modules/python_visualization/python_visualization_intro_rmv_answ.ipynb).
## Exercise

For example purposes, we will make use of a phenotypic dataset from the ABIDE II consortium. This amazing international multi-site dataset contains data from individuals diagnosed with Autism Spectrum Disorder (ASD) and healthy controls. We will use a version of the phenotypic [data](http://fcon_1000.projects.nitrc.org/indi/abide/abide_II.html) from a single site (Kennedy Krieger Institute). To download the dataset, click on the link and then 'Kennedy Krieger Institute' on the right-hand side. Then, Downloads -> Phenotypic File. You will need an NITRC account - if you don't have one, you can create one in a few minutes [here](https://www.nitrc.org/account/register.php).
In the exercise notebook (`exercise_visu_en.ipynb`), you will have to create static and interactive visualization to explore the phenotypic and fMRI data from the **ADHD200** dataset available through nilearn.

1. **Read through the notebook running all the cells**
2. **Complete the exercises in the notebook**
The exercise is structured as follows:
1. **Part 1 : Exploring phenotypic data**: you will visualize some clinical and demographic variables of the ADHD200 dataset.
2. **Part 2 : Exploring fMRI data**: you will explore the functional fMRI data from the ADHD200 dataset through visualizations.

**Exercise 1** Create a figure with a single axes and replot the second scatterplot to group by sex instead of dx_group.
**Important**: follow the parameter specifications given in each question exactly — the exercise uses automated grading that compares results to reference values.

Set the figure size to a ratio of 8 (wide) x 5 (height)
Use the colors red and gray
Set the opacity of the points to 0.5
Label the axes
Add a legend

**Exercise 2** Using a pairwise plot, compare the distributions of age, viq, and piq with respect to dx_group.

Set a palette
Set style to ticks
Set context to paper
Suppress the dx_group variable from being on the plot

**Exercise 3** Using a violin plot separate out viq as a function of sex and dx_group.

Different dx_group should be on each half of each violin
The x-axis should reflect the different sex categories.

**Exercise 4** Play around and make an interactive plot using plotly and your project data if you have any.

* Follow up with your local TA(s) to validate you completed the exercises correctly.
* :tada: :tada: :tada: you completed this training module! :tada: :tada: :tada:
Follow up with your local TA(s) to validate you completed the exercises correctly.

## More resources

- Other great resources to get started with plotting in python:
- [dartbrains](https://dartbrains.org/content/Introduction_to_Plotting.html)
- [dartbrains](https://dartbrains.org/Introduction_to_Plotting/)
- [neurohackademy](https://github.com/neurohackademy/visualization-in-python/blob/master/visualization-in-python.ipynb)
- [PythonDataScienceHandbook](https://nbviewer.jupyter.org/github/jakevdp/PythonDataScienceHandbook/blob/master/notebooks/04.00-Introduction-To-Matplotlib.ipynb)
- [matplolib tutorial - rougier](https://github.com/rougier/matplotlib-tutorial)

<iframe width="560" height="315" src="https://www.youtube.com/embed/FwM_6oZo_2g" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

- Interactive plotting
- Interactive plotting:
- [Interactive plots and the spectrum of data visualization](https://www.youtube.com/watch?v=FwM_6oZo_2g&t=1s)
- [Plotly](https://plotly.com/python/)
- [Bokeh](https://docs.bokeh.org/en/latest/index.html)
- [Altair](https://altair-viz.github.io/)

- Gallery
- Gallery:
- [seaborn gallery](https://seaborn.pydata.org/examples/index.html)
- [Python Graph Gallery](https://python-graph-gallery.com/)
Loading