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
Please go to the Matplotlib tutorial page.
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))
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.
What's wrong with this graphic ? How would you correct it ?
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 ?
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).
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.
- Wind map
- Alien life
- Pendulum
- Less is more
- Anatomy of a figure
- Ten simple rules for better figures (code)
- Matplotlib tutorial, N.P. Rougier, 2016.
- Ten simple rules for better figures (article), N.P. Rougier, M. Droettboom, P.E. Bourne, 2014.
- Scientific Visualization course, Paul Rosen, 2015.
- Information Visualization, T. Munzner, 2015.
- The Quartz guide to bad data, C. Groskopf, 2015.
- Quantitative vs. Categorical Data: A Difference Worth Knowing, S. Few , 2005.
- How to make beautiful data visualizations in Python with matplotlib, Randy Olson, 2014.
- Matplotlib, J. Hunter and M. Droettboom, 2010.
- 10 Useful Python Data Visualization Libraries for Any Discipline, M. Bierly, 2016.
- Datavisualization.ch, 2015.
- Data visualization catalogue, S. Ribecca, 2016.
- Fred's ImageMagick script, F. Weinhaus, 2016.
- TikZ and PGF, Stefan Kottwitz
- Python & OpenGL for Scientific Visualization, Nicolas Rougier, 2018
- Fundamentals of Data Visualization, Claus O. Wilke, 2017
- Visualization Analysis and Design ($), T. Munzner, 2014.
- Trees, maps, and theorems ($), J.-L. Doumont, 2009.
- The Visual Display of Quantitative Information ($), E.R. Tufte, 1983.
- A Tour through the Visualization Zoo, J. Heer, M. Bostock, and V. Ogievetsky, 2010.
- The most misleading charts of 2015, fixed, K. Collins, 2015.
- Data is beautiful / reddit.
- Junk charts, K. Fung, 2005-2016.
- WTF Visualizations, community supported.
- How to Display Data Badly, H. Wainer, 1984.
- Effective graphical displays, Jean-Luc Doumont, 2009.
- exercise-1-sol.py / exercise-1-sol.png (adapted from "Trees, maps, and theorems")
- exercise-2-sol.sh or exercise-2-sol.py
- exercise-3-sol.py / exercise-3-sol.png (adapted from "The most misleading charts of 2015, fixed")
- exercise-4-sol.md or exercise-4-sol.py
- exercise-5-sol.py / exercise-5-sol.png