{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Matplotlib Sliders without a separate Controls Figure\n\nDemonstration of how to provide a matplotlib slider to prevent\nthe creation of a separate controls figure.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport numpy as np\nfrom matplotlib.widgets import Slider\n\nfrom mpl_interactions import ipyplot as iplt\n\nfig, ax = plt.subplots()\nplt.subplots_adjust(bottom=0.25)\nx = np.linspace(0, 2 * np.pi, 200)\n\n\ndef f(x, freq):\n    return np.sin(x * freq)\n\n\naxfreq = plt.axes([0.25, 0.1, 0.65, 0.03])\nslider = Slider(axfreq, label=\"freq\", valmin=0.05, valmax=10)\ncontrols = iplt.plot(x, f, freq=slider, ax=ax)\nplt.show()"
      ]
    }
  ],
  "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.7.9"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}