{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Jscatter\n",
    "\n",
    "![Jscatter](https://jscatter.readthedocs.io/en/latest/_images/Jscatter.jpeg \"Jscatter\")\n",
    "\n",
    "A template for playing around or to start your own work."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Prerequisite "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "!{sys.executable} -m pip install jscatter\n",
    "\n",
    "%matplotlib notebook\n",
    "import jscatter as js\n",
    "import numpy as np\n",
    "js.usempl(True) "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### A dataList with some data to play with"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def sinus(x, A, a, B, p=0):\n",
    "    return A * np.sin(a * x + p) + B\n",
    "\n",
    "x = x = np.r_[0:10:0.1]\n",
    "\n",
    "data = js.dL()\n",
    "ef = 0.02  # increase this to increase error bars of final result\n",
    "for ff in [0.001, 0.4, 0.8, 1.2, 1.6]:\n",
    "    data.append(np.c_[x,sinus(x,ff, ff, ef * ff * np.random.randn(len(x))), x * 0 + ef * ff].T)\n",
    "    data[-1].B = 0.2 * ff / 2  # add attributes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### plot it"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "p=js.mplot()\n",
    "p.Plot(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# go on"
   ]
  }
 ],
 "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.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
