Verified Commit 49ba8e36 authored by Renato Alves's avatar Renato Alves 🌱
Browse files

Add section about jupyter widgets

parent 3d119e8d
......@@ -826,9 +826,6 @@ Which looks great, but something unexpected happened in the stacked subplot.
# Changing style
## Color maps
## Widgets in jupyter
https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Basics.html
# Plotting from pandas
As we saw at the end of the [Working with Data](../02-data/) section,
......@@ -1016,7 +1013,6 @@ were referred to as strings -
it is assumed that string values like these will refer to columns inside the
`DataFrame` from which `plot` was called.
> ## Other plotting methods
>
> In addition to the `kind`s of plot we can produce with `.plot`
......@@ -1037,20 +1033,6 @@ it is assumed that string values like these will refer to columns inside the
> `.plot(kind='box')` or `.plot(kind='hist')`.
{: .callout }
> ## Further Reading - plotting from pandas
>
> We have only superficially explored the pandas plotting interface here
> because we don't want to create further confusion by dwelling on
> _yet another_ interface to Matplotlib.
> If you'd like to learn more about this topic,
> we recommend the following resources:
>
> - [pandas user guide](https://pandas.pydata.org/pandas-docs/stable/user_guide/visualization.html)
> - [links included in pandas "cookbook" section on plotting](https://pandas.pydata.org/pandas-docs/stable/user_guide/cookbook.html#cookbook-plotting)
> - [a blogpost about changing the plotting backend used by Pandas](https://towardsdatascience.com/plotting-in-pandas-just-got-prettier-289d0e0fe5c0)
{: .callout }
# Where to go from here
## The Matplotlib Gallery
......@@ -1065,11 +1047,19 @@ This is the price to pay for matplotlib's flexibility.
## Pandas documentation
For `pandas` specific guidance you will find the [pandas visualization documentation][pd-viz]
and the [pandas plotting cookbook][pd-cook-plot] the most useful.
These pages provide a `pandas` centric way of producing plots.
Although many of the functions return `matplotlib` objects, you may find that `pandas`
implemented its own convenient functions, better suited to the dataframe way of data handling.
We have only superficially explored the `pandas` plotting interface here
because we don't want to create further confusion by dwelling on
_yet another_ interface to Matplotlib.
If you'd like to learn more about this topic,
we recommend the following resources:
- [pandas user guide][pd-viz]
- [links included in pandas "cookbook" section on plotting][pd-cook-plot]
- [a blogpost about changing the plotting backend used by Pandas](https://towardsdatascience.com/plotting-in-pandas-just-got-prettier-289d0e0fe5c0)
Many of the plotting functions in `pandas` return `matplotlib` objects.
However, you may find that `pandas` implemented its own convenient functions,
better suited to the dataframe way of handling data.
## Stack Overflow
......@@ -1098,6 +1088,21 @@ but not complete.
If you need advanced 3D capabilities, you might want to look into [VTK][vtk-py], [Blender3D][blender3d-py] or if visualizing 3D proteins, the well known [pymol][pymol-py].
## Widgets in jupyter
Previously we mentioned that Jupyter can assist with the try-and-see
nature of plot generation.
If you want to go beyond the *edit code and re-run* approach you
should consider [Jupyter widgets](https://ipywidgets.readthedocs.io/en/latest/examples/Using%20Interact.html).
With little code, you can add sliders, drop-down boxes and other HTML elements to your
Jupyter output. The `interact()` function, leverages these widgets
to provide a convenient way to re-plot results triggered
by the simple action of moving a slider or ticking a checkbox.
These widgets really shine when you want to have a flexible and interactive
way to experiment with different thresholds,
perhaps while showing your latest results to your colleagues.
# Exercises
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment