Using visualization packages (AEN 4.2.1)
========================================

.. raw:: html

    <p>AEN supports multiple visualization packages for Python and R language.</p>
    <p>For Python, the default environment has
    <a class="reference internal" href="#matplotlib-pkg"><span class="std std-ref">Matplotlib</span></a> and <a class="reference internal" href="#bokeh-pkg"><span class="std std-ref">Bokeh</span></a>
    installed.</p>
    <p>For R language, the default environment has
    <a class="reference internal" href="#ggplot2-pkg"><span class="std std-ref">r-ggplot2</span></a> and r-bokeh installed.</p>
    <div class="section" id="matplotlib">
    <span id="matplotlib-pkg"></span><h2>Matplotlib<a class="headerlink" href="#matplotlib" title="Permalink to this headline">¶</a></h2>
    <p>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.</p>
    <p>To display Matplotlib figures in the output cells of a notebook running the
    default environment, run:</p>
    <div class="highlight-none"><div class="highlight"><pre><span></span>import matplotlib.pyplot as plt
    %matplotlib inline
    </pre></div>
    </div>
    <p>Any Matplotlib figures in the notebook are displayed in it&#8217;s output cells.</p>
    <p>EXAMPLE: The following screenshot is of a cumulative density function (CDF) plot
    using values taken from a normal distribution:</p>
    <div class="figure">
    <a class="reference internal image-reference" href="../../../../_images/ae-notebooks/4.2.1/aen-user-visualization_mpl.png"><img alt="../../../../_images/ae-notebooks/4.2.1/aen-user-visualization_mpl.png" src="../../../../_images/ae-notebooks/4.2.1/aen-user-visualization_mpl.png" style="width: 50%;" /></a>
    </div>
    <div class="line-block">
    <div class="line"><br /></div>
    </div>
    <p>For more information, including a <a class="reference external" href="http://matplotlib.org/gallery.html">gallery</a>, <a class="reference external" href="http://matplotlib.org/examples/index.html">examples</a>, <a class="reference external" href="http://matplotlib.org/contents.html">documentation</a> and a <a class="reference external" href="http://matplotlib.org/api/pyplot_summary.html">list of plotting commands</a>, see the <a class="reference external" href="http://matplotlib.org/">Matplotlib website</a>.</p>
    </div>
    <div class="section" id="bokeh">
    <span id="bokeh-pkg"></span><h2>Bokeh<a class="headerlink" href="#bokeh" title="Permalink to this headline">¶</a></h2>
    <p><a class="reference external" href="http://bokeh.pydata.org/">Bokeh</a> is an interactive visualization library that
    targets modern web browsers to provide elegant, concise construction of novel
    graphics.</p>
    <p>To display Bokeh figures in the output cells of a notebook running the default
    environment, run:</p>
    <div class="highlight-none"><div class="highlight"><pre><span></span>from bokeh.io import output_notebook, show
    output_notebook()
    </pre></div>
    </div>
    <p>Any Bokeh figures in the notebook are displayed in its output cells.</p>
    <p>The following screenshot is of a scatter plot of miles-per-gallon vs. horsepower
    for 392 automobiles using the <code class="docutils literal"><span class="pre">autompg</span></code> sample dataset:</p>
    <div class="figure">
    <a class="reference internal image-reference" href="../../../../_images/ae-notebooks/4.2.1/aen-user-visualization_bokehMPG.png"><img alt="../../../../_images/ae-notebooks/4.2.1/aen-user-visualization_bokehMPG.png" src="../../../../_images/ae-notebooks/4.2.1/aen-user-visualization_bokehMPG.png" style="width: 50%;" /></a>
    </div>
    <div class="line-block">
    <div class="line"><br /></div>
    </div>
    </div>
    <div class="section" id="ggplot2">
    <span id="ggplot2-pkg"></span><h2>ggplot2<a class="headerlink" href="#ggplot2" title="Permalink to this headline">¶</a></h2>
    <p><a class="reference external" href="http://ggplot2.org/">Ggplot2</a> is a plotting system for R language which is
    based on the grammar of graphics. Ggplot2 tries to take only the good parts of
    base and lattice graphics and none of the bad parts.</p>
    <p>To use ggplot2 with AEN:</p>
    <ol class="arabic">
    <li><p class="first">Open a new Notebook using the R kernel.</p>
    </li>
    <li><p class="first">Load the ggplot2 library with the following code:</p>
    <div class="highlight-none"><div class="highlight"><pre><span></span>library(ggplot2)
    </pre></div>
    </div>
    </li>
    </ol>
    <p>The ggplot2 library is loaded and ready for use in AEN.</p>
    <p>The following screenshot is of a scatter plot of sepal width vs sepal
    length using the <code class="docutils literal"><span class="pre">iris</span></code> dataset provided by the <code class="docutils literal"><span class="pre">dplyr</span></code> library:</p>
    <div class="figure">
    <a class="reference internal image-reference" href="../../../../_images/ae-notebooks/4.2.1/aen-user-visualization_ggplot.png"><img alt="../../../../_images/ae-notebooks/4.2.1/aen-user-visualization_ggplot.png" src="../../../../_images/ae-notebooks/4.2.1/aen-user-visualization_ggplot.png" style="width: 50%;" /></a>
    </div>
    <div class="line-block">
    <div class="line"><br /></div>
    </div>
    </div>
