Visualization
=============

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 <http://matplotlib.org/>`_ 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 <http://matplotlib.org/gallery.html>`_,
`examples <http://matplotlib.org/examples/index.html>`_,
`documentation <http://matplotlib.org/contents.html>`_, and a `list of
plotting commands <http://matplotlib.org/api/pyplot_summary.html>`_ on
the `matplotlib website <http://matplotlib.org/>`_.

Bokeh
~~~~~

`Bokeh <http://bokeh.pydata.org/>`_ 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 <http://ggplot2.org/>`_ 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|

.. |mplCDF| image:: /img/aen-user-visualization_mpl.png
.. |bokehMPG| image:: /img/aen-user-visualization_bokehMPG.png
.. |ggplot| image:: /img/aen-user-visualization_ggplot.png
