Create artistic visualisations with your exercise data
Project description
strava_py
Create artistic visualisations with your exercise data (Python version).
This is a port of the R strava package to Python.
Installation
Install via pip:
python3 -m pip install stravavis
For development:
git clone https://github.com/marcusvolz/strava_py
cd strava_py
pip install -e .
Then run from the terminal:
stravavis --help
How to use
If your activity data is in a folder called activities, run the following command:
stravavis activities
By default, this will create output images prefixed strava-.
If you have an activities.csv file:
stravavis activities --activities_path activities.csv
To only map activities contained within a bounding box:
stravavis activities --bbox 24.782802,59.922486,25.254511,60.29785
Or as a shortcut, save bounding-box coordinates to a file:
echo 24.782802,59.922486,25.254511,60.29785 > helsinki.bbox
stravavis activities --bbox helsinki.bbox
To only plot certain visualisations:
stravavis activities --plot map facets landscape
Examples
Facets
A plot of activities as small multiples. The concept behind this plot was originally inspired by Sisu.
Map
A map of activities viewed in plan.
Elevations
A plot of activity elevation profiles as small multiples.
Landscape
Elevation profiles superimposed.
Calendar
Calendar heatmap showing daily activity distance, using the calmap package. Requires "activities.csv" from the bulk Strava export.
Dumbbell plot
Activities shown as horizontal lines by time of day and day of year, facetted by year. Requires "activities.csv" from the bulk Strava export.
Bulk export from Strava
The process for downloading data is described on the Strava website here: [https://support.strava.com/hc/en-us/articles/216918437-Exporting-your-Data-and-Bulk-Export#Bulk], but in essence, do the following:
- Log in to Strava
- Select "Settings" from the main drop-down menu at top right of the screen
- Select "My Account" from the navigation menu to the left of the screen.
- Under the "Download or Delete Your Account" heading, click the "Get Started" button.
- Under the "Download Request", heading, click the "Request Your Archive" button. Don't click anything else on that page, i.e. particularly not the "Request Account Deletion" button.
- Wait for an email to be sent
- Click the link in email to download zipped folder containing activities
- Unzip files
Programmatic use
The package can also be used programmatically. The following code snippets demonstrate how to use the package to create the visualisations.
The main function for importing and processing activity files expects a path to a directory of unzipped GPX and / or FIT files. If required, the fit2gpx package provides useful tools for pre-processing bulk files exported from Strava, e.g. unzipping activity files (see Use Case 3: Strava Bulk Export Tools).
df = process_data("<path to folder with GPX and / or FIT files>")
Some plots use the "activities.csv" file from the Strava bulk export zip. For those plots, create an "activities" dataframe using the following function:
activities = process_activities("<path to activities.csv file>")
Plot activities as small multiples
plot_facets(df, output_file = 'plot.png')
Plot activity map
plot_map(df, lon_min=None, lon_max= None, lat_min=None, lat_max=None,
alpha=0.3, linewidth=0.3, output_file="map.png")
Plot elevations
plot_elevations(df, output_file = 'elevations.png')
Plot landscape
plot_landscape(df, output_file = 'landscape.png')
Plot calendar
plot_calendar(activities, year_min=2015, year_max=2017, max_dist=50,
fig_height=9, fig_width=15, output_file="calendar.png")
Plot dumbbell
plot_dumbbell(activities, year_min=2012, year_max=2015, local_timezone='Australia/Melbourne',
fig_height=34, fig_width=34, output_file="dumbbell.png")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stravavis-0.6.0.tar.gz.
File metadata
- Download URL: stravavis-0.6.0.tar.gz
- Upload date:
- Size: 223.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55ab2f5a7123d6820888ca950f2616a5e8fc40a37a39b88696a083f1b2635459
|
|
| MD5 |
eea123b131ff8ae8bb54eb9c2ece3497
|
|
| BLAKE2b-256 |
e8ad00fab60dc545323dfaac6707a6968e62c338d22e8b8c154a68fce354ee3a
|
Provenance
The following attestation bundles were made for stravavis-0.6.0.tar.gz:
Publisher:
deploy.yml on marcusvolz/strava_py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stravavis-0.6.0.tar.gz -
Subject digest:
55ab2f5a7123d6820888ca950f2616a5e8fc40a37a39b88696a083f1b2635459 - Sigstore transparency entry: 781171986
- Sigstore integration time:
-
Permalink:
marcusvolz/strava_py@176b05786fc64ee7d8fff2fe88b3a44f108edd9e -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/marcusvolz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@176b05786fc64ee7d8fff2fe88b3a44f108edd9e -
Trigger Event:
release
-
Statement type:
File details
Details for the file stravavis-0.6.0-py3-none-any.whl.
File metadata
- Download URL: stravavis-0.6.0-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02617c210919b4c115965b181e2a7f26b79f4c3120932dcc89d7b1a267878ed8
|
|
| MD5 |
00d82c8f7c2f979af993676d114ac89f
|
|
| BLAKE2b-256 |
f7ef715eecffa4c296d1c110f8ab75687be31ac355b1658af26734d14476c452
|
Provenance
The following attestation bundles were made for stravavis-0.6.0-py3-none-any.whl:
Publisher:
deploy.yml on marcusvolz/strava_py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stravavis-0.6.0-py3-none-any.whl -
Subject digest:
02617c210919b4c115965b181e2a7f26b79f4c3120932dcc89d7b1a267878ed8 - Sigstore transparency entry: 781171987
- Sigstore integration time:
-
Permalink:
marcusvolz/strava_py@176b05786fc64ee7d8fff2fe88b3a44f108edd9e -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/marcusvolz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@176b05786fc64ee7d8fff2fe88b3a44f108edd9e -
Trigger Event:
release
-
Statement type: