# strava_py
Create artistic visualisations with your exercise data (Python version).
This is a port of the [R strava package](https://github.com/marcusvolz/strava) to
Python.
## Installation
Install via pip:
```sh
python3 -m pip install stravavis
```
For development:
```sh
git clone https://github.com/marcusvolz/strava_py
cd strava_py
pip install -e .
```
Then run from the terminal:
```sh
stravavis --help
```
## Examples
### Facets
A plot of activities as small multiples. The concept behind this plot was originally
inspired by [Sisu](https://twitter.com/madewithsisu).
![facets](https://raw.githubusercontent.com/marcusvolz/strava_py/main/plots/facets001.png "Facets, showing activity outlines")
### Map
A map of activities viewed in plan.
![map](https://raw.githubusercontent.com/marcusvolz/strava_py/main/plots/map001.png "A map of activities viewed in plan")
### Elevations
A plot of activity elevation profiles as small multiples.
![map](https://raw.githubusercontent.com/marcusvolz/strava_py/main/plots/elevations001.png "A plot of activity elevation profiles as small multiples")
### Landscape
Elevation profiles superimposed.
![map](https://raw.githubusercontent.com/marcusvolz/strava_py/main/plots/landscape001.png "Elevation profiles superimposed")
### Calendar
Calendar heatmap showing daily activity distance, using the
[calmap](https://pythonhosted.org/calmap/) package. Requires "activities.csv" from the
bulk Strava export.
![map](https://raw.githubusercontent.com/marcusvolz/strava_py/main/plots/calendar001.png "Calendar heatmap")
### 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.
![map](https://raw.githubusercontent.com/marcusvolz/strava_py/main/plots/dumbbell001.png "Dumbbell plot")
## How to use
### 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:
1. Log in to [Strava](https://www.strava.com/)
2. Select "[Settings](https://www.strava.com/settings/profile)" from the main drop-down
menu at top right of the screen
3. Select "[My Account](https://www.strava.com/account)" from the navigation menu to the
left of the screen.
4. Under the
"[Download or Delete Your Account](https://www.strava.com/athlete/delete_your_account)"
heading, click the "Get Started" button.
5. 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._**
6. Wait for an email to be sent
7. Click the link in email to download zipped folder containing activities
8. Unzip files
### Process the data
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](https://github.com/dodo-saba/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).
```python
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:
```python
activities = process_activities("<path to activities.csv file>")
```
### Plot activities as small multiples
```python
plot_facets(df, output_file = 'plot.png')
```
### Plot activity map
```python
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
```python
plot_elevations(df, output_file = 'elevations.png')
```
### Plot landscape
```python
plot_landscape(df, output_file = 'landscape.png')
```
### Plot calendar
```python
plot_calendar(activities, year_min=2015, year_max=2017, max_dist=50,
fig_height=9, fig_width=15, output_file="calendar.png")
```
### Plot dumbbell
```python
plot_dumbbell(activities, year_min=2012, year_max=2015, local_timezone='Australia/Melbourne',
fig_height=34, fig_width=34, output_file="dumbbell.png")
```
Raw data
{
"_id": null,
"home_page": null,
"name": "stravavis",
"maintainer": "Hugo van Kemenade",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "artistic, artistic visualisations, exercise, exercise data, strava, visualisation",
"author": "Marcus Volz",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/7c/63/5e4341e2785e4d04e27620a20a0186fc67c743e1fcb60d93912df01e70bb/stravavis-0.5.0.tar.gz",
"platform": null,
"description": "# strava_py\n\nCreate artistic visualisations with your exercise data (Python version).\n\nThis is a port of the [R strava package](https://github.com/marcusvolz/strava) to\nPython.\n\n## Installation\n\nInstall via pip:\n\n```sh\npython3 -m pip install stravavis\n```\n\nFor development:\n\n```sh\ngit clone https://github.com/marcusvolz/strava_py\ncd strava_py\npip install -e .\n```\n\nThen run from the terminal:\n\n```sh\nstravavis --help\n```\n\n## Examples\n\n### Facets\n\nA plot of activities as small multiples. The concept behind this plot was originally\ninspired by [Sisu](https://twitter.com/madewithsisu).\n\n![facets](https://raw.githubusercontent.com/marcusvolz/strava_py/main/plots/facets001.png \"Facets, showing activity outlines\")\n\n### Map\n\nA map of activities viewed in plan.\n\n![map](https://raw.githubusercontent.com/marcusvolz/strava_py/main/plots/map001.png \"A map of activities viewed in plan\")\n\n### Elevations\n\nA plot of activity elevation profiles as small multiples.\n\n![map](https://raw.githubusercontent.com/marcusvolz/strava_py/main/plots/elevations001.png \"A plot of activity elevation profiles as small multiples\")\n\n### Landscape\n\nElevation profiles superimposed.\n\n![map](https://raw.githubusercontent.com/marcusvolz/strava_py/main/plots/landscape001.png \"Elevation profiles superimposed\")\n\n### Calendar\n\nCalendar heatmap showing daily activity distance, using the\n[calmap](https://pythonhosted.org/calmap/) package. Requires \"activities.csv\" from the\nbulk Strava export.\n\n![map](https://raw.githubusercontent.com/marcusvolz/strava_py/main/plots/calendar001.png \"Calendar heatmap\")\n\n### Dumbbell plot\n\nActivities shown as horizontal lines by time of day and day of year, facetted by year.\nRequires \"activities.csv\" from the bulk Strava export.\n\n![map](https://raw.githubusercontent.com/marcusvolz/strava_py/main/plots/dumbbell001.png \"Dumbbell plot\")\n\n## How to use\n\n### Bulk export from Strava\n\nThe process for downloading data is described on the Strava website here:\n[https://support.strava.com/hc/en-us/articles/216918437-Exporting-your-Data-and-Bulk-Export#Bulk],\nbut in essence, do the following:\n\n1. Log in to [Strava](https://www.strava.com/)\n2. Select \"[Settings](https://www.strava.com/settings/profile)\" from the main drop-down\n menu at top right of the screen\n3. Select \"[My Account](https://www.strava.com/account)\" from the navigation menu to the\n left of the screen.\n4. Under the\n \"[Download or Delete Your Account](https://www.strava.com/athlete/delete_your_account)\"\n heading, click the \"Get Started\" button.\n5. Under the \"Download Request\", heading, click the \"Request Your Archive\" button.\n **_Don't click anything else on that page, i.e. particularly not the \"Request Account\n Deletion\" button._**\n6. Wait for an email to be sent\n7. Click the link in email to download zipped folder containing activities\n8. Unzip files\n\n### Process the data\n\nThe main function for importing and processing activity files expects a path to a\ndirectory of unzipped GPX and / or FIT files. If required, the\n[fit2gpx](https://github.com/dodo-saba/fit2gpx) package provides useful tools for\npre-processing bulk files exported from Strava, e.g. unzipping activity files (see Use\nCase 3: Strava Bulk Export Tools).\n\n```python\ndf = process_data(\"<path to folder with GPX and / or FIT files>\")\n```\n\nSome plots use the \"activities.csv\" file from the Strava bulk export zip. For those\nplots, create an \"activities\" dataframe using the following function:\n\n```python\nactivities = process_activities(\"<path to activities.csv file>\")\n```\n\n### Plot activities as small multiples\n\n```python\nplot_facets(df, output_file = 'plot.png')\n```\n\n### Plot activity map\n\n```python\nplot_map(df, lon_min=None, lon_max= None, lat_min=None, lat_max=None,\n alpha=0.3, linewidth=0.3, output_file=\"map.png\")\n```\n\n### Plot elevations\n\n```python\nplot_elevations(df, output_file = 'elevations.png')\n```\n\n### Plot landscape\n\n```python\nplot_landscape(df, output_file = 'landscape.png')\n```\n\n### Plot calendar\n\n```python\nplot_calendar(activities, year_min=2015, year_max=2017, max_dist=50,\n fig_height=9, fig_width=15, output_file=\"calendar.png\")\n```\n\n### Plot dumbbell\n\n```python\nplot_dumbbell(activities, year_min=2012, year_max=2015, local_timezone='Australia/Melbourne',\n fig_height=34, fig_width=34, output_file=\"dumbbell.png\")\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Create artistic visualisations with your exercise data",
"version": "0.5.0",
"project_urls": {
"Homepage": "https://github.com/marcusvolz/strava_py",
"Source": "https://github.com/marcusvolz/strava_py"
},
"split_keywords": [
"artistic",
" artistic visualisations",
" exercise",
" exercise data",
" strava",
" visualisation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a5fd9448ad0379f93dc242ca78e874b9f76e6ebd9a34bc5ea9d543433036b86d",
"md5": "433f5d7efee494d81bd391618a4e31ee",
"sha256": "798e560b4bbb6802256a7ff21628f5e102a7f3ceffc367182680e816412d5d79"
},
"downloads": -1,
"filename": "stravavis-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "433f5d7efee494d81bd391618a4e31ee",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 12523,
"upload_time": "2024-10-20T12:40:27",
"upload_time_iso_8601": "2024-10-20T12:40:27.730133Z",
"url": "https://files.pythonhosted.org/packages/a5/fd/9448ad0379f93dc242ca78e874b9f76e6ebd9a34bc5ea9d543433036b86d/stravavis-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7c635e4341e2785e4d04e27620a20a0186fc67c743e1fcb60d93912df01e70bb",
"md5": "6237dcfd3fd3dad02923f3aa0f0ae33d",
"sha256": "fead04225492e82ccd210274ac13c391510ee8cd81b99151c045b245acb01744"
},
"downloads": -1,
"filename": "stravavis-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "6237dcfd3fd3dad02923f3aa0f0ae33d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 224428,
"upload_time": "2024-10-20T12:40:29",
"upload_time_iso_8601": "2024-10-20T12:40:29.217065Z",
"url": "https://files.pythonhosted.org/packages/7c/63/5e4341e2785e4d04e27620a20a0186fc67c743e1fcb60d93912df01e70bb/stravavis-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-20 12:40:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "marcusvolz",
"github_project": "strava_py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "stravavis"
}