- What makes a good visualization?
- How do we create a good visualization?
- Visualizing Pandas Data
- Plotting Libraries
- Matplotlib
- Seaborn
- Plotly
- Principles of Graphical Excellence

## What makes a good visualization?

Excellence in statistical graphics consists of complex ideas communicated with clarity, precision, and efficiency. Graphics should:

- Show the data
- Induce the viewer to think about the substance rather than about methodology, graphic design, technology or something else
- Avoid distorting what the data have to say
- Present many numbers in a small space
- Make large data sets coherent
- Encourage the eye to compare different pieces of data
- Reveal the data at several levels of detail from a broad overview to the fine structure

## How do we create a good visualization?

A good visualization utilizes three main components; **simplicity**, **clarity**, and **creativity**. These three components can be used in each step of the creation process. The main steps of the creation process are as follows:

- Choose the visual that communicates the story the best
- Create a barebones version of the visual
- Adjust the colors, sizes, positions, and layers to emphasize the statistic, trend, or area of importance
- Critique your work.
- Is the visual cluttered?
- Is the color scheme effective?
- Does the visual communicate the desired message?
- Can I make the visual simpler and still communicate the desired message?

# Visualizing Pandas Data

See

# Plotting Libraries

## Matplotlib

Easiest visualization library for beginners

Best for simple plots and rough visuals

✅ Easiest of the three to implement. Generally takes the least lines and not long to execute.

❌ Visualization looks unpolished

```
import numpy as np
import matplotlib.pyplot as plt
a = np.arange(0,10,.25)
b = np.sin(a)
plt.scatter(a,b)
plt.xlabel('time (s)')
plt.ylabel('force (N)')
plt.title('Projected Force')
plt.show()
```

## Seaborn

Designed for statistical visualizations. Seaborn is built on matplotlib, so it functions similarly.

Simple plots that need to be touched up a bit

✅ Since it builds on matplotlib, it has all the same functionality while adding some visuals

❌ Not as versatile as matplotlib. Cannot create some types of plots.

```
sns.set(style = 'darkgrid')
a = np.arange(0,10,.25)
b = np.sin(a)
c = np.cos(a)+1
ax = sns.scatterplot(x = a, y = b)
bx = sns.scatterplot(x = a, y = c)
ax.set_xlabel('time (s)')
ax.set_ylabel('force (N)')
ax.set_title('Projected Force')
plt.show()
```

## Plotly

Sophisticated customization

More elaborate

✅ Most powerful of the three options. Lots of customization without losing functionality. Creates cleaner, more interactive plots.

❌ More difficult

```
import numpy as np
import plotly.express as px
a = np.arange(0,10,.25)
b = np.sin(a)
c = np.cos(a) + 1
fig = px.scatter(x = a, y = [b, c])
fig.show()
```

# Principles of Graphical Excellence

Graphical excellence is the well-designed presentation of interesting data-- a matter of substance, of statistics, and of design. Graphical excellence consists of complex ideas communicated with clarity, precision, and efficiency. Graphical excellence is that which gives to the viewer the greatest number of ideas in the shortest time with the least ink in the smallest space.