Try out nbgather 🧽✨

Let's say you open this notebook after taking a few days off. You wonder, How did I make that scatter plot? Didn't I have a better version of it? And can I get clean this code without breaking things?

The problem is that the cells are out of order and code was overwritten.

With nbgather, you can answer these questions!

  1. Hover over the scatter plot and click Gather
  2. Lines with the purple background were the ones used to create the chart.
  3. To open a notebook with the ordered, cleaned up code... Click "Gather to Notebook"
  4. To view all previous versions of the scatter plot... Click "Gather to Version Browser"

You can gather code for any variable or output that was added to the notebook after nbgather was installed. Try it by producing defining some variables and displaying some results.

Learn more about these tools and leave feedback at the nbgather site.

In [14]:
kmeans = KMeans(n_clusters=4)
clusters = kmeans.fit(data).labels_
In [15]:
scatter(petal_length, petal_width, c=clusters)
Out[15]:
<matplotlib.collections.PathCollection at 0x11e5cdb38>
In [1]:
from matplotlib.pyplot import scatter
from sklearn.cluster import KMeans
from sklearn import datasets
In [2]:
data = datasets.load_iris().data[:,2:4]
petal_length, petal_width = data[:,0], data[:,1]
In [16]:
petal_length, petal_width = data[:,1], data[:,0]
In [3]:
print("Average petal length: %.3f" % (sum(petal_length) / len(petal_length),))
Average petal length: 3.758
In [ ]: