Dataviz in Python: Stephen Few’s new jittering

I am always excited to get news of a new Visual Business Intelligence Newsletter in my Inbox, and that is what arrived at the end of last week. This time Few takes on “jittering”, and suggests an interesting alternative to adding random noise.

Here is a little python snippet to do it:

def wheat_plot(x):
    hist, bin_edges = np.histogram(x)
    
    # make y position based on values of hist
    y = []
    for h_i in hist:
        y += range(h_i)

    plt.plot(sorted(x), y, 'o')
    plt.yticks([])

Here is a notebook that makes that code do something: https://gist.github.com/aflaxman/235f94f9563b1675233d6d35cd30b8c2

Also Jeff Heer and company made an interactive version in Vega: https://vega.github.io/vega/examples/wheat-plot/

Comments Off on Dataviz in Python: Stephen Few’s new jittering

Filed under Uncategorized

Comments are closed.