Skip to content

Material for the Advanced Scientific Programming in Python course on data visualization

License

Notifications You must be signed in to change notification settings

ASPP/ASPP-2018-dataviz

Repository files navigation

Scientific visualization

Nicolas P. Rougier, G-Node summer school, Camerino, Italy , 2018

Visualisation is a method of computing. It transforms the symbolic into the geometric, enabling researchers to observe their simulations and computations. Visualisation offers a method for seeing the unseen. It enriches the process of scientific discovery and fosters profound and unexpected insights.

Visualisation in Scientific Computing, NSF report, 1987.

Scientific visualization is classically defined as the process of graphically displaying scientific data. However, this process is far from direct or automatic. There are so many different ways to represent the same data: scatter plots, linear plots, bar plots, and pie charts, to name just a few. Furthermore, the same data, using the same type of plot, may be perceived very differently depending on who is looking at the figure. A more accurate definition for scientific visualization would be a graphical interface between people and data. But remember, there are two people in the loop: the one that produces the visualization and the one that watches it. What you intend to show might be quite different from what will be actually perceived...

The goal of this course is to introduce a few concepts in order for you to achieve better visualization. If you want to go further, you'll have to look at the miscellaneous references given at the end of this document.

Table of Contents

Tutorial

Please go to the Matplotlib tutorial page.

Exercises

Too much ink

Consider the following figure and, using matplotlib, try to remove as much ink as you can while keeping the most relevant information.

You can start from the following python script:

import numpy as np
import matplotlib.pyplot as plt

np.random.seed(123)

def gaussian(x, a, x0, sigma):
    return a*np.exp(-(x-x0)**2/(2*sigma**2))

# Clean data
X = np.linspace(15, 21, 100)
Y = gaussian(X, 0.65, 17.6, 1.)

# Noisy dat
Xn = np.random.uniform(16, 20, 25)
Yn = gaussian(Xn, 0.65, 17.6, 1.) + 0.01 * np.random.normal(size=len(Xn))

The right tool

You have a nice image and you would like to show labeled detailed sub-images alongside the main image (see below). What could be the easiest way to do that ? Be careful with the labels, they must be visible independently of the images color/contrast.

Misleading

What's wrong with this graphic ? How would you correct it ?

Editor's request

Your article just been accepted but the editor request figure 2 to be at least 300 dpi. What does that mean ? What is the minium size (in pixels) of your figure ? Is it relevant if you figure has been saved in vector format ?

Replication

Look at Drawing a brain with Bokeh and try to replicate the final figure using matpltolib.

or

Pick one of your favorite graphic from the litterature and try to replicate it using matplotlib (and fake data).

References

There exist many online resources about scientific visualization and a lot of excellent books as well. Since you probably not have time to read everything, I collected a small set of resources that might be read relatively rapidly.

Made with matplotlib

Courses/Tutorials/Guides

(Some) Tools

Books

Good examples

Bad examples (don't do that at home)

Solutions

  1. exercise-1-sol.py / exercise-1-sol.png (adapted from "Trees, maps, and theorems")
  2. exercise-2-sol.sh or exercise-2-sol.py
  3. exercise-3-sol.py / exercise-3-sol.png (adapted from "The most misleading charts of 2015, fixed")
  4. exercise-4-sol.md or exercise-4-sol.py
  5. exercise-5-sol.py / exercise-5-sol.png

About

Material for the Advanced Scientific Programming in Python course on data visualization

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages