-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGUI.py
93 lines (58 loc) · 1.94 KB
/
GUI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# -*- coding: utf-8 -*-
"""
Created on Jan 02 17:15:42 2017
@author: Antoine Gélin
"""
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.mlab as mlab
from matplotlib import cm as cmap
import matplotlib.pyplot as plt
def build_map(dico):
"""
Construit la carte des stations
Args:
Returns:
>>>
"""
MY_MAP = Basemap(llcrnrlon=1.5, llcrnrlat=48.5, urcrnrlon=2.8, urcrnrlat=49.240305,
rsphere=(6378137.00, 6356752.3142), resolution='l', projection='merc', epsg=4326)
# MY_MAP = Basemap(llcrnrlon=-10, llcrnrlat=40, urcrnrlon=10, urcrnrlat=55,
# rsphere=(6378137.00, 6356752.3142), resolution='l',
# projection='merc', epsg=4326 )
lon = []
lat = []
poids = []
for station in dico:
poids.append(station[0])
lon.append(station[1][0])
lat.append(station[1][1])
MIN_POIDS = min(poids)
X_COORD, Y_COORD = MY_MAP(lon, lat)
CMAP = plt.cm.get_cmap('cool')
SIZE = (np.array(poids)-MIN_POIDS+1)*20
MY_MAP.arcgisimage(xpixels =1600 , verbose = False, service= 'ESRI_StreetMap_World_2D')
heatmap, xedges, yedges = np.histogram2d(lon, lat, bins=200)
SCA = MY_MAP.scatter(X_COORD, Y_COORD, s=10, marker='o', c=poids, cmap=CMAP)
plt.colorbar(SCA)
plt.show()
def build_histo(dico):
"""
Construit la carte des stations
Args:
Returns:
>>>
"""
# the histogram of the data
n, bins, patches = plt.hist(list(dico.values()),bins=30,edgecolor="k")
# add a 'best fit' line
plt.xlabel('Nombre de voyageurs')
plt.ylabel('nombre de stations ayant x voyageurs')
plt.title("Histogramme de l'utilisation des stations")
plt.grid(True)
plt.show()
def main():
build_map()
pass
if __name__ == '__main__':
main()