Posts in matplotlib

Trendlines With Matplotlib

Okay, they look like sparklines, but as Tufte reminds us, sparklines are really meant to be super condensed and mostly used inline. But sometimes, a plot very much similar to sparklines can be a great way of showing trends.

Let’s call them trendlines.

I saw these sparklinesque plots used in the NYT Upshot article about the food trends.

Right now, I am working on blog post for OpenTable, and decided to quickly hand roll some code to plot these. Scroll to the bottom for the code, but here are how the results look:

python trendline(xx, yy, xtick_pos_and_labels=[[0,6,12,18,24],['2000','2006','2012','2018','2024']])

written in matplotlib, plotting, python, sparkline, trendline Read on →