Visualization (AEN 4.1.2)#

Plotting

Anaconda Enterprise Notebooks supports multiple visualization packages for Python and R language.

For Python the default environment has Matplotlib and Bokeh already installed.

For R language the default environment has r-ggplot2 and r-bokeh already installed.

Matplotlib

Matplotlib is a Python 2D and 3D plotting and visualization library that produces publication-quality figures in a variety of hardcopy formats and interactive environments across platforms.

In a notebook running the default environment Matplotlib figures can be displayed in the output cells by executing the following code.

import matplotlib.pyplot as plt
%matplotlib inline

For example, here’s screen shot of a cumulative density function (CDF) plot of values taken from a normal distribution.

mplCDF

You can find a gallery, examples, documentation, and a list of plotting commands on the matplotlib website.

Bokeh

Bokeh is an interactive visualization library that targets modern web browsers to provide elegant, concise construction of novel graphics.

In a notebook running the default environment, Bokeh figures can be displayed in the output cells by executing the following code.

from bokeh.io import output_notebook, show
output_notebook()

Here’s a screen shot of a scatter plot of of miles-per-gallon vs. horsepower for 392 automobiles using the autompg sample dataset.

bokehMPG

ggplot

ggplot2 is a plotting system for R language, based on the grammar of graphics, which tries to take the good parts of base and lattice graphics and none of the bad parts.

To use ggplot2 with Anaconda Enterprise Notebooks open a new notebook using the R kernel. You can then load the ggplot2 library with the following code.

library(ggplot2)

Here’s a screen shot of a scatter plot of sepal width vs sepal length using the iris dataset provided by the dplyr library.

ggplot