Plotting Apple Health Weight

Generated weight chart
Generated chart with Shortcuts and Pythonista.

Sporadically, I log my weight into Apple Health on my phone. I want to see my weight charted over time but I don’t like to keep yet another app around for this purpose. This is better solved with some iOS automation and the Shortcuts app.

The problem is Shortcuts itself has no capability to chart data. Enter Pythonista. Pythonista is a full-fledged Python environment on your iOS device! It even includes the matplotlib library which we’ll use to plot the weight samples.

Since Pythonista has no API for accessing Apple Health data, we’ll use Shortcuts as a frontend. This shortcut collects the weight samples as CSV, then calls this Pythonista script which generates the chart and returns the image back to the calling shortcut.

The result is the chart above. The cool thing is, everything—from data collection to charting—happens right on your phone and without having to install third-party one-purpose apps.

Download the shortcut here and the Python script here and then install it in Pythonista.