Exploratory data analysis is an important part of the development phase of a data science model. The EDA helps data scientists gain a better understanding of data variables and their relationship, and reveal formal modeling or hypotheses outside of the testing task. Matplotlib is a popular Python drawing library that provides an object-oriented programming interface for embedding plots in applications.
There are many open source libraries to Create interactive plots, including Bokeh, Altair, Plotly. In this article, you can learn how to make existing matplotlib inline plots interactive in Jupyter Notebook or Jupyter Lab IDE just by adding a few lines of Python code. This can be possible by using two open source libraries
ipywidgets (also known as the jupyter widget) a library used internally to create widgets. The package provides interactive HTML widgets for Jupyter notebooks and the IPython kernel.
ipymlp is another Python package that converts IPython notebooks to easily editable YAML files. The advantage of using
ipymlphas full compatibility with IPython laptops and the ability to edit files in any text editor.
Both packages can be installed from PyP1 using:
pip install ipywidgets --user
pip install ipympl --user
Installing the necessary packages by mail allows
ipympl extensions using:
jupyter nbextension enable --py --sys-prefix widgetsnbextension
jupyter nbextension install --py --symlink --sys-prefix ipympl
Now that you want all the matplotlib plot as widgets, you can change the look
%matplotlib magic command.
%matplotlib inlinethe magic command of the drawing commands output is displayed down the line in interfaces such as the Jupyter notebook, directly below the code cell that produced it.
%matplotlib widgetto get all the plot as a widget
After changing the wallpaper using
%matplotlib widget , the lines generated by the matplolib package appear inside the widget pane. Character
canvas the element is a real interactive Jupyter widget that can be placed in an interactive widget layout format. Now, instead of a static linear matplotlib curve, you have an interactive plot with some given functions. The widget screen appears:
Using the interactive graph above, you can resize, pan, and zoom graphs. One also has the ability to zoom in and outline the plot for a given x and y coordinate angle.
Below the GIF describes how to move through the time series line and get insights from it.
The Matplotlib widget is a handy tool, and its biggest advantage is that it does not require such a change in your Python code. There are several other Python packages, including Plotly, Altair, Boker, that produce interactive lines, but first you need to customize the API functionality of the new library.
 Ipympl GitHub repository: https://github.com/matplotlib/ipympl
Thanks for reading