<commit_before>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "input_collapsed": false
   },
   "outputs": [],
   "source": [
    "from __future__ import print_function\n",
    "import numpy as np\n",
    "from collections import OrderedDict\n",
    "from traitlets import link\n",
    "from IPython.display import display\n",
    "from ipywidgets import *\n",
    "\n",
    "from bqplot import *\n",
    "from bqplot.interacts import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "input_collapsed": false
   },
   "outputs": [],
   "source": [
    "x_data = [1, 2, 3, 4, 5, 6, 7]\n",
    "\n",
    "y_data = [\n",
    "    [160.10, 162.34, 161.82, 162.24, 161.44, 158.51, 157.68, 151.93, 151.41, 153.06, 155.38, 161.07, 160.51, 162.99, 161.86, 163.27, 164.05, 164.52, 162.67],\n",
    "    [161.54, 162.17, 161.95, 161.76, 162.15, 160.92, 160.64, 161.43, 161.89, 164.16, 164.16, 162.79, 161.92, 163.30, 163.49, 162.07, 161.46, 161.82, 162.65],\n",
    "    [164.40, 164.35, 163.46, 163.60, 161.87, 162.08, 162.18, 161.79, 163.23, 169.10, 182.05, 179.84, 181.75, 183.80, 183.52, 185.93, 186.42, 189.36, 185.71],\n",
    "    [188.67, 186.91, 187.17, 189.83, 189.64, 190.06, 189.01, 192.31, 191.62, 193.11, 194.00, 193.75, 192.80, 192.96, 191.81, 191.28, 191.72, 191.20, 190.68],\n",
    "    [191.95, 191.56, 192.30, 192.00, 192.25, 192.99, 191.16, 190.41, 191.23, 190.10, 190.07, 189.36, 187.38, 187.88, 191.81, 191.28, 191.72, 189.99, 190.14],\n",
    "    [187.95, 187.34, 187.47, 186.63, 184.30, 185.97, 187.10, 189.64, 189.15, 191.67, 194.00, 194.57, 195.78, 194.40, 195.24, 193.63,  190.85, 192.5, 192.49],\n",
    "    [192.36, 188.49, 189.86, 188.00, 187.70, 188.42, 187.22, 188.04, 188.53, 188.39, 186.35, 181.27, 181.71, 180.37, 180.72, 180.88, 182.14, 181.55, 182.82]\n",
    "]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "sc_x = LinearScale()\n",
    "sc_y = LinearScale()\n",
    "ax_x = Axis(label='Test X', scale=sc_x )\n",
    "ax_y = Axis(label='Test Y', scale=sc_y, orientation='vertical', tick_format='0.2f')\n",
    "boxes = Boxplot(x=x_data, y=y_data, scales={'x': sc_x, 'y': sc_y}, \n",
    "                box_fill_color='gray', outlier_fill_color='white')\n",
    "fig = Figure(axes=[ax_x, ax_y], marks=[boxes])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def change_ydata():\n",
    "    for i in range(len(y_data)):\n",
    "        for j in range(len(y_data[i])):\n",
    "            y_data[i][j] = 150"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "input_collapsed": false
   },
   "outputs": [],
   "source": [
    "selected=Latex()\n",
    "\n",
    "def change_callback( name, value ):\n",
    "    selected.value = str(value)\n",
    "    change_ydata()\n",
    "    print(y_data)\n",
    "    boxes.y = y_data\n",
    "                \n",
    "selected.value = ''\n",
    "\n",
    "pz = PanZoom(scales={'x': [sc_x], 'y': [sc_y]})\n",
    "multi_sel = MultiSelector(scale=sc_x, marks=[boxes])\n",
    "br_intsel = BrushIntervalSelector(scale=sc_x, marks=[boxes])\n",
    "index_sel = IndexSelector(scale=sc_x, marks=[boxes])\n",
    "int_sel = FastIntervalSelector(scale=sc_x, marks=[boxes])\n",
    "\n",
    "multi_sel.on_trait_change(change_callback, name='idx_selected')\n",
    "br_intsel.on_trait_change(change_callback, name='selected')\n",
    "index_sel.on_trait_change(change_callback, name='idx_selected')\n",
    "int_sel.on_trait_change(change_callback, name='selected')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "input_collapsed": false
   },
   "outputs": [],
   "source": [
    "selection = ToggleButtons(options=OrderedDict([('PanZoom', pz), \n",
    "                                               ('FastIntervalSelector', int_sel), ('IndexSelector', index_sel),\n",
    "                                               ('BrushIntervalSelector', br_intsel), ('MultiSelector', multi_sel),\n",
    "                                               ('None', None)]))\n",
    "display(selected)\n",
    "display(fig)\n",
    "display(selection)\n",
    "\n",
    "link((selection, 'value'), (fig, 'interaction'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "input_collapsed": false
   },
   "outputs": [],
   "source": [
    "boxes.stroke = 'red'\n",
    "boxes.box_fill_color = 'blue'\n",
    "boxes.outlier_fill_color = 'red'\n",
    "boxes.opacities = [0.1, 0.2]"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
<commit_msg>cleaned up to remove interactions<commit_after>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "input_collapsed": false
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import bqplot as bq\n",
    "from IPython.display import display"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "input_collapsed": false
   },
   "outputs": [],
   "source": [
    "x_data = [1, 2, 3, 4, 5, 6, 7]\n",
    "\n",
    "y_data = [\n",
    "    [160.10, 162.34, 161.82, 162.24, 161.44, 158.51, 157.68, 151.93, 151.41, 153.06, 155.38, 161.07, 160.51, 162.99, 161.86, 163.27, 164.05, 164.52, 162.67],\n",
    "    [161.54, 162.17, 161.95, 161.76, 162.15, 160.92, 160.64, 161.43, 161.89, 164.16, 164.16, 162.79, 161.92, 163.30, 163.49, 162.07, 161.46, 161.82, 162.65],\n",
    "    [164.40, 164.35, 163.46, 163.60, 161.87, 162.08, 162.18, 161.79, 163.23, 169.10, 182.05, 179.84, 181.75, 183.80, 183.52, 185.93, 186.42, 189.36, 185.71],\n",
    "    [188.67, 186.91, 187.17, 189.83, 189.64, 190.06, 189.01, 192.31, 191.62, 193.11, 194.00, 193.75, 192.80, 192.96, 191.81, 191.28, 191.72, 191.20, 190.68],\n",
    "    [191.95, 191.56, 192.30, 192.00, 192.25, 192.99, 191.16, 190.41, 191.23, 190.10, 190.07, 189.36, 187.38, 187.88, 191.81, 191.28, 191.72, 189.99, 190.14],\n",
    "    [187.95, 187.34, 187.47, 186.63, 184.30, 185.97, 187.10, 189.64, 189.15, 191.67, 194.00, 194.57, 195.78, 194.40, 195.24, 193.63,  190.85, 192.5, 192.49],\n",
    "    [192.36, 188.49, 189.86, 188.00, 187.70, 188.42, 187.22, 188.04, 188.53, 188.39, 186.35, 181.27, 181.71, 180.37, 180.72, 180.88, 182.14, 181.55, 182.82]\n",
    "]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "sc_x = bq.LinearScale()\n",
    "sc_y = bq.LinearScale()\n",
    "ax_x = bq.Axis(label='X', scale=sc_x )\n",
    "ax_y = bq.Axis(label='Y', scale=sc_y, orientation='vertical', tick_format='0.1f')\n",
    "boxes = bq.Boxplot(x=x_data, y=y_data, scales={'x': sc_x, 'y': sc_y}, \n",
    "                box_fill_color='gray', outlier_fill_color='black')\n",
    "Figure(axes=[ax_x, ax_y], marks=[boxes])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false,
    "input_collapsed": false
   },
   "outputs": [],
   "source": [
    "boxes.stroke = 'red'\n",
    "boxes.box_fill_color = 'blue'\n",
    "boxes.outlier_fill_color = 'red'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "boxes.opacities = [0.1, 0.2]"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}

{'fraction_non_alphanumeric': 0.22498825739783937, 'fraction_numerical': 0.16169563175199625, 'mean_word_length': 2.6491002570694087, 'pattern_counts': {'":': 116, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4973694', 'n_tokens_mistral': 4658, 'n_tokens_neox': 3531, 'n_words': 676}