https://github.com/colcarroll/strava_calendar
Visualizations from Strava data in matplotlib
https://github.com/colcarroll/strava_calendar
Last synced: about 1 year ago
JSON representation
Visualizations from Strava data in matplotlib
- Host: GitHub
- URL: https://github.com/colcarroll/strava_calendar
- Owner: ColCarroll
- License: mit
- Created: 2019-01-08T20:00:43.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-12-10T03:16:04.000Z (over 1 year ago)
- Last Synced: 2025-03-31T10:05:56.766Z (about 1 year ago)
- Language: Python
- Size: 748 KB
- Stars: 95
- Watchers: 5
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Strava Calendar
A project to make beautiful visualizations from Strava data. Heavily inspired by the [wonderful R library by Markus Volz](https://github.com/marcusvolz/strava).
## Install
```python
pip install git+git://github.com/colcarroll/strava_calendar.git
```
## Use
First download your data from Strava (see below for how). The last step gives you a `zip_path` to the archive with all the data. ***This is quite slow the first time you run it for a zip file and year (~5mins), but quite fast after that (~5s).***
```python
from strava_calendar import plot_calendar
plot_calendar(zip_path=zip_path, year=2018)
```

You can control how many columns there are, the spacing between months and columns, and the label in the top left:
```python
plot_calendar(zip_path=zip_path, year=2017, n_cols=6, month_gap=1.5, col_gap=1, label='')
```

You can also plot a single column of weeks, which is pleasant.
```python
plot_calendar(zip_path=zip_path, year=2017, n_cols=1)
```

If you want to write more custom code, you can give that a shot, too:
```python
import datetime
import matplotlib.pyplot as plt
from strava_calendar import Plotter, get_data
data = get_data(zip_path, 'running', datetime.datetime(2018, 1, 1), datetime.datetime(2019, 1, 1))
plotter = Plotter(data)
fig, ax = plt.subplots(figsize=(9, 6))
fig, ax, offset = plotter.plot_month(year=2018, month=6, fig=fig, ax=ax)
ax.text(0, offset + 4.2, 'Weeee!', fontdict={'fontsize': 32, 'fontweight': 'heavy'}, alpha=0.5)
```

## See also!
Downloading your data is a bit of a pain. You migh as well try out [this awesome project](https://github.com/Lisa-Ho/year-in-sports) while you're visualizing your year!
## Bulk export from Strava
The process for downloading data is also [described on the Strava website](https://support.strava.com/hc/en-us/articles/216918437-Exporting-your-Data-and-Bulk-Export#Bulk):
1. After logging into Strava, select "[Settings](https://www.strava.com/settings/profile)" from the main drop-down menu at top right of the screen.
2. Select "[My Account](https://www.strava.com/account)" from the navigation menu to the left of the screen.
3. Under the "[Download or Delete Your Account](https://www.strava.com/athlete/delete_your_account)" heading, click the "Get Started" button.
4. Under the "Download Request", heading, click the "Request Your Archive" button. ***Be careful not to delete your account here!***
5. The archive takes a while to be sent. Download the zipped file to a location whose path you know.