Welcome to gpxplotter’s documentation!

gpxplotter is a small package for reading .gpx files and generating plots and maps using matplotlib and folium. The source code for gpxplotter can be found at Github: https://github.com/andersle/gpxplotter.

Here is a short example of the usage of gpxplotter (please see Creating maps and Creating simple plots for more examples):

"""
Track colored by heart rate
===========================

This example will create a map and color the track according
to the measured heart rate.
"""
import folium

from gpxplotter import (
    add_all_tiles,
    add_segment_to_map,
    create_folium_map,
    read_gpx_file,
)

the_map = create_folium_map(tiles="kartverket_topo4")
# Add pre-defined tiles:
add_all_tiles(the_map)

for track in read_gpx_file("example1.gpx"):
    for i, segment in enumerate(track["segments"]):
        add_segment_to_map(the_map, segment, color_by="hr")

# Add layer control to change tiles:
folium.LayerControl(sortLayers=True).add_to(the_map)

# To store the map as a HTML page:
# the_map.save('map_001.html')

# To display the map in a Jupyter notebook:
the_map

Installing gpxplotter

gpxplotter can be installed via pip:

pip install gpxplotter