When this notebook first loads on nbviewer, all of the input cells are hidden. To reveal them, click the element tag icon in the top right of nbviewer. Click it again to hide them once more.
The last code cell loads a CDN-hosted script to enable the show/hide interactivity. The script encapsulates the recipe from http://chris-said.io/2016/02/13/how-to-make-polished-jupyter-presentations-with-optional-code-visibility/.
It's cool, too, that the plot.ly example remains interactive on nbviewer as well.
from plotly.offline import init_notebook_mode, iplot, iplot_mpl import matplotlib.pyplot as plt import numpy as np