{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import floatview\n",
    "import pandas as pd\n",
    "import requests\n",
    "import io\n",
    "import random"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "tab = pd.read_csv('cars.csv', index_col=False, sep=';', skiprows=[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "5f7072f307ba438ca905cabb5a1b3edc",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "GlueManagerWidget(children=(VBox(children=(VBox(children=(Dropdown(description='Colorset', index=4, layout=Lay…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "5670f7b002d9438babdc6e218e23a44c",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Output()"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "gmw = floatview.GlueManagerWidget(tab, modal=False, label=\"400Cars\", display_console=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <script type=\"text/javascript\">\n",
       "        window.PlotlyConfig = {MathJaxConfig: 'local'};\n",
       "        if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}\n",
       "        if (typeof require !== 'undefined') {\n",
       "        require.undef(\"plotly\");\n",
       "        requirejs.config({\n",
       "            paths: {\n",
       "                'plotly': ['https://cdn.plot.ly/plotly-latest.min']\n",
       "            }\n",
       "        });\n",
       "        require(['plotly'], function(Plotly) {\n",
       "            window._Plotly = Plotly;\n",
       "        });\n",
       "        }\n",
       "        </script>\n",
       "        "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "53a20ff27d7743469fbebdeab8d9ede3",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Output()"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "f01 = gmw.gluemanager.newView(\"table\", [\"Car\", \"MPG\"], \"Table\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <script type=\"text/javascript\">\n",
       "        window.PlotlyConfig = {MathJaxConfig: 'local'};\n",
       "        if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}\n",
       "        if (typeof require !== 'undefined') {\n",
       "        require.undef(\"plotly\");\n",
       "        requirejs.config({\n",
       "            paths: {\n",
       "                'plotly': ['https://cdn.plot.ly/plotly-latest.min']\n",
       "            }\n",
       "        });\n",
       "        require(['plotly'], function(Plotly) {\n",
       "            window._Plotly = Plotly;\n",
       "        });\n",
       "        }\n",
       "        </script>\n",
       "        "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "ed17689a736949ec92881f10fdaf531d",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Output()"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "f02 = gmw.gluemanager.newView(\"sankey\", [\"Acceleration\", \"Cylinders\", \"Model\", \"MPG\"], \"Sankey\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "for k in range(3):\n",
    "    gmw.gluemanager.updateSelection([random.randint(0,100) for i in range(20)])\n",
    "    gmw.gluemanager.createSubsetFromSelection(label='subset' + str(k) )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f03 = gmw.gluemanager.newView(\"parallelscat\", [\"Acceleration\", \"Cylinders\", \"MPG\"], \"Parallels\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "#for k in range(1,2):\n",
    "#    gmw.disableComponentFromSelection('subset' + str(k))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f04 = gmw.gluemanager.newView(\"sankey\", [\"Acceleration\", \"Cylinders\", \"MPG\"], \"Parallels\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f05 = gmw.gluemanager.newView(\"scattermatrix\", [\"Cylinders\", \"Model\", \"MPG\", \"Acceleration\" ], \"Scatter\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f06 = gmw.gluemanager.newView(\"scatter\", [\"MPG\", \"Acceleration\"], \"Scatter\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f07 = gmw.gluemanager.newView(\"sankeytree\", [\"Acceleration\", \"MPG\", \"Cylinders\"], \"Sankey\", modal=False, only_view=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f08 = gmw.gluemanager.newView(\"sunburst\", [\"Cylinders\", \"Acceleration\", \"MPG\", \"Weight\"], \"Sunburst\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f09 = gmw.gluemanager.newView(\"parallels\", [\"Acceleration\", \"Cylinders\", \"MPG\",\"Cylinders\",\"Weight\"], \"Parallels\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f10 = gmw.gluemanager.newView(\"table\", [\"Acceleration\", \"Cylinders\", \"MPG\",\"Cylinders\",\"Weight\"], \"Table\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f11 = gmw.gluemanager.newView(\"histogram\", [\"Cylinders\"], \"Histogram\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f12 = gmw.gluemanager.newView(\"contour\", [\"Weight\", \"MPG\"], \"Contour\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f13 = gmw.gluemanager.newView(\"errorbar\", [\"Acceleration\", \"Cylinders\"], \"Errorbar\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f14 = gmw.gluemanager.newView(\"composed_lines\", [\"Cylinders\", \"MPG\", \"Weight\"], \"Composed Lines\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f15 = gmw.gluemanager.newView(\"composed_polyfit_3d\", [\"MPG\",\"Weight\",\"MPG\"], \"Composed Poly\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f16 = gmw.gluemanager.newView(\"scatter3D\", [\"MPG\",\"Horsepower\",\"Weight\"], \"Scatter3D\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f17 = gmw.gluemanager.newView(\"image\", [\"MPG\",\"Horsepower\",\"Weight\"], \"Image\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f18 = gmw.gluemanager.newView(\"pca\", [\"Acceleration\", \"Cylinders\", \"Model\", \"MPG\"], \"Principal Component Analisis\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f19 = gmw.gluemanager.newView(\"corrcoef\", [\"Acceleration\", \"Cylinders\", \"MPG\",\"Car\",\"Weight\"], \"Correlation Matrix\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "#f20 = gmw.gluemanager.newView(\"network\", [\"Acceleration\", \"MPG\"], \"Network\", modal=False);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "#from floatview.dataexplorer import DataExplorer\n",
    "#DataExplorer()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "#from ipywidgets import ColorPicker\n",
    "#help (ColorPicker)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
