Visual communication of results from analysis. The story told by the images should enhance the understanding of the viewer versus viewing raw data or equations.
Visual representation of data:
"information that has been abstracted in some schematic form, including attributes or variables for the units of information"
Data visualization is both an art and a science. The are many good and bad examples of what should be done.
In [15]:
from IPython.display import Image
from IPython.core.display import HTML
Image(url= "https://upload.wikimedia.org/wikipedia/commons/b/ba/Data_visualization_process_v1.png"
,height=400, width=550)
Out[15]:
The are a number of packages that we could use to present the data. In this case we will be exploring the use of matplotlib. Use '%matplotlib inline' line in your ipython notebook to activate the inline viewing of the plots
In [26]:
%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
plt.plot(np.arange(10))
Out[26]:
In [27]:
#Plots in matplotlib reside in a figure object. Create a new figure object with
plt.figure()
Out[27]:
In [29]:
fig = plt.figure()
In [32]:
ax1 = fig.add_subplot(2,2,1)
ax2 = fig.add_subplot(2,2,2)
ax3 = fig.add_subplot(2,2,3)
#Empty Matplotlib figure with three subplots
fig
Out[32]:
In [34]:
plt.plot(randn(50).cumsum(),'k--')
Out[34]:
k-- is a style option for black dashed lines
In [46]:
_ = ax1.hist(randn(100), bins=20, color='k', alpha=0.3)
ax2.scatter(np.arange(30), np.arange(30) +3 * randn(30))
Out[46]:
In [47]:
fig
Out[47]:
In [ ]: