Gapminder visualization

Hans Rosling

Most people do not understand the current world situation

Chimpanzee test

Ploting

Panda plot
MatlibPlot
Seaborn

Plotly

Panda Plot

Wrapper around MatlibPlot

DataFrame Plot Methods

DataFrame.plot([x, y, kind, ax, ….])
DataFrame.plot.area([x, y])
DataFrame.plot.bar([x, y])
DataFrame.plot.barh([x, y])
DataFrame.plot.box([by])
DataFrame.plot.density([bw_method, ind])
DataFrame.plot.hexbin(x, y[, C, …])
DataFrame.plot.hist([by, bins])
DataFrame.plot.kde([bw_method, ind])
DataFrame.plot.line([x, y])
DataFrame.plot.pie([y])
DataFrame.plot.scatter(x, y[, s, c])
DataFrame.boxplot([column, by, ax, …])
DataFrame.hist([column, by, grid, …])

Docs

MatlibPlot

State machine

Function and Object interface

Terms

Figure

matplotlib.pyplot.subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, subplot_kw=None, gridspec_kw=None, **fig_kw)

Saving plots to file

savefig saves the current active figure to a file

Matplotlib.pyplot Functions

Read the Docs

Matplotlib.pyplot.plot()

All those arguments

Seaborn

Examples from tutorial

Documentation

seaborn.lmplot( x, y, data, hue=None, col=None, row=None,

    palette=None, col_wrap=None, height=5, aspect=1,

    markers='o', sharex=True, sharey=True, hue_order=None, 

    col_order=None, row_order=None, legend=True, legend_out=True,

    x_estimator=None, x_bins=None, x_ci='ci', scatter=True, fit_reg=True, 

    ci=95, n_boot=1000, units=None, order=1, logistic=False, lowess=False,

    robust=False, logx=False, x_partial=None, y_partial=None, truncate=False,

    x_jitter=None, y_jitter=None, scatter_kws=None, line_kws=None, size=None)

For Future Reference

Setting figsize does not work

Use Panda's to processs the data before ploting

Why repeat plt.figure(figsize=(20,6))

Jupyter resets plot settings at the end of each cell

Except for some settings

pairplot

Plot pairwise relationships in a dataset

Seaside Plot Types

List of plot types

Themes

"white", "dark", "whitegrid", "darkgrid", "ticks"

Error Message

/anaconda/lib/python3.6/site-packages/scipy/stats/stats.py:1713: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq]. In the future this will be interpreted as an array index, arr[np.array(seq)], which will result either in an error or a different result. return np.add.reduce(sorted[indexer] * weights, axis=axis) / sumval

Due to using python 3.7 or greater with scipy 1.1 or less

Color Palettes

Overlaying Plots