@@ -25,32 +25,93 @@ pip install ezgpx
25
25
26
26
``` python
27
27
import ezgpx
28
+ import matplotlib
28
29
29
30
# Parse GPX file
30
31
gpx = ezgpx.GPX(" file.gpx" )
31
32
32
33
# Simplify (using Ramer-Dougle-Peucker algorithm)
33
34
gpx.simplify()
34
35
35
- # Plot with Matplotlib
36
- gpx.matplotlib_plot(color = " elevation" ,
37
- start_stop_colors = (" green" , " red" ),
38
- way_points_color = " blue" ,
39
- title = gpx.name(),
40
- duration = (0 , 0 ),
41
- distance = (0.5 , 0 ),
42
- ascent = None ,
43
- pace = (1 , 0 ),
44
- speed = None ,
45
- file_path = " img_1" )
46
-
47
36
# Remove metadata
48
37
gpx.remove_metadata()
49
38
39
+ # Plot with Matplotlib
40
+ test_gpx.matplotlib_plot(figsize = (16 ,9 ),
41
+ size = 6 ,
42
+ color = " ele" ,
43
+ cmap = matplotlib.cm.get_cmap(" gnuplot" , 12 ),
44
+ colorbar = False ,
45
+ start_point_color = " green" ,
46
+ stop_point_color = " red" ,
47
+ way_points_color = None ,
48
+ background = " World_Imagery" ,
49
+ offset_percentage = 0.04 ,
50
+ dpi = 100 ,
51
+ title = test_gpx.name(),
52
+ title_fontsize = 20 ,
53
+ watermark = True ,
54
+ file_path = " img_1.png" )
55
+
50
56
# Write new simplified GPX file
51
57
gpx.to_gpx(" new_file.gpx" )
52
58
```
53
- ![ ] ( img/matplotlib_plot_1.png )
59
+ ![ ] ( img/matplotlib_plot_1.jpg )
60
+
61
+ ## 🏋️ Advanced Use
62
+
63
+ ``` python
64
+ import ezgpx
65
+ import matplotlib
66
+
67
+ # Parse GPX file
68
+ gpx = ezgpx.GPX(" file.gpx" )
69
+
70
+ # Plot with Matplotlib
71
+ test_gpx.expert_plot(figsize = (16 ,9 ),
72
+ subplots = (3 ,2 ),
73
+ map_position = (0 ,0 ),
74
+ map_size = 10 ,
75
+ map_color = " ele" ,
76
+ map_cmap = matplotlib.cm.get_cmap(" viridis" , 12 ),
77
+ map_colorbar = True ,
78
+ start_point_color = None ,
79
+ stop_point_color = None ,
80
+ way_points_color = None ,
81
+ background = " World_Imagery" ,
82
+ offset_percentage = 0.04 ,
83
+ xpixels = 1000 ,
84
+ ypixels = None ,
85
+ dpi = 100 ,
86
+ elevation_profile_position = (1 ,0 ),
87
+ elevation_profile_size = 10 ,
88
+ elevation_profile_color = " ele" ,
89
+ elevation_profile_cmap = matplotlib.cm.get_cmap(" viridis" , 12 ),
90
+ elevation_profile_colorbar = False ,
91
+ elevation_profile_grid = True ,
92
+ elevation_profile_fill_color = " lightgray" ,
93
+ elevation_profile_fill_alpha = 0.5 ,
94
+ pace_graph_position = (2 ,0 ),
95
+ pace_graph_size = 10 ,
96
+ pace_graph_color = " ele" ,
97
+ pace_graph_cmap = None ,
98
+ pace_graph_colorbar = False ,
99
+ pace_graph_grid = True ,
100
+ pace_graph_fill_color = " lightgray" ,
101
+ pace_graph_fill_alpha = 0.5 ,
102
+ pace_graph_threshold = 15 ,
103
+ ascent_rate_graph_position = (1 ,1 ),
104
+ made_with_ezgpx_position = (0 ,1 ),
105
+ shared_color = " ele" ,
106
+ shared_cmap = None ,
107
+ shared_colorbar = True ,
108
+ data_table_position = (2 ,1 ),
109
+ title = test_gpx.name(),
110
+ title_fontsize = 20 ,
111
+ watermark = False ,
112
+ file_path = " img_2.png" )
113
+ ```
114
+ ![ ] ( img/expert_plot_1.jpg )
54
115
55
116
## 👤 Author
56
117
- Fabien ALLEMAND
0 commit comments