=============================
Visualizations and dashboards
=============================

Data Science & AI Workbench makes it easy for you to create and share interactive data visualizations, live notebooks or machine learning models built using popular libraries such as Bokeh and HoloViews.

To get you started quickly, Workbench provides sample projects of Bokeh applications for clustering and cross filtering data. There are also several `examples of Workbench projects that use HoloViz here <https://examples.holoviz.org/>`_.

****

To create an interactive plot:

#. From the |file-code| **Projects** view, create a new project using the minimal Python templates:

   .. thumbnail:: ../images/project_templates.png
      :align: center

#. Open a session for your newly created project. 
#. Open a terminal. 
#. Run the following command to install ``hvplot`` and ``panel``:

    .. code-block:: none

        anaconda-project add-packages hvplot panel

#. Create a new Notebook and rename it to ``tips.ipynb``.
#. Add the following code to ``tips.ipynb``:

    .. code-block:: python

        import pandas as pd
        import hvplot.pandas
        import panel
    
        panel.extension()
    
        df = pd.read_csv('http://bit.ly/tips-csv')
        p = df.hvplot.scatter(x='total_bill', y='tip', hover_cols=['sex','day','size'])
        pn.panel(p).servable()

    .. note::

        In this example, the data is being read from the Internet. Alternatively,
        you could `download <https://raw.githubusercontent.com/mwaskom/seaborn-data/master/tips.csv>`_
        the ``.csv`` and upload it to the project.

#. Open the project's ``anaconda-project.yml`` file, and add the following deployment command:

    .. code-block:: yaml

        commands:
          scatter-plot:
          unix: panel serve tips.ipynb
          supports_http_options: True
    
#. :ref:`Save and commit your changes <commit_changes>`. 
#. :doc:`Deploy the project <deployments/index>`. 

.. tip::
    
    For a deeper dive into data visualization, follow `this HoloViz tutorial <https://holoviz.org/tutorial/index.html>`_.   

.. |file-code| raw:: html

   <svg class="inline" height="1.2em" width="1.2em" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M64 496c-26.5 0-48-21.5-48-48V64c0-26.5 21.5-48 48-48H204.1c1.3 0 2.6 .1 3.9 .2V136c0 22.1 17.9 40 40 40H367.8c.2 1.3 .2 2.6 .2 3.9V448c0 26.5-21.5 48-48 48H64zM358.6 157.3c.9 .9 1.7 1.8 2.4 2.7H248c-13.3 0-24-10.7-24-24V22.9c1 .8 1.9 1.6 2.7 2.4L358.6 157.3zM64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V179.9c0-12.7-5.1-24.9-14.1-33.9L238.1 14.1c-9-9-21.2-14.1-33.9-14.1H64zm85.7 269.7c3.1-3.1 3.1-8.2 0-11.3s-8.2-3.1-11.3 0l-56 56c-3.1 3.1-3.1 8.2 0 11.3l56 56c3.1 3.1 8.2 3.1 11.3 0s3.1-8.2 0-11.3L99.3 320l50.3-50.3zm96-11.3c-3.1-3.1-8.2-3.1-11.3 0s-3.1 8.2 0 11.3L284.7 320l-50.3 50.3c-3.1 3.1-3.1 8.2 0 11.3s8.2 3.1 11.3 0l56-56c3.1-3.1 3.1-8.2 0-11.3l-56-56z"/></svg>