Bonjour à tous,
Je cherche à afficher une carte dans un petit GUI. Mon problème est que je n'arrive pas à afficher la colorbar dans le GUI. Voilà comment je procède:
1) Définition de la carte de fond:
2) Affiche des données:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 def atlfacade(MainBox): global mapandle, figandle ltmin, ltmax = 43., 52. lgmin, lgmax = -12., 3. figandle = Figure(figsize=(10, 10), dpi=120) ax = figandle.add_subplot(111) mapandle = Basemap(llcrnrlon=lgmin,llcrnrlat=ltmin,urcrnrlon=lgmax,urcrnrlat=ltmax, projection='merc',lat_ts=45.,resolution ='h',area_thresh=0., ax = ax) #Lambert Conformal Conic map. mapandle.drawcoastlines() mapandle.drawcountries() mapandle.fillcontinents(color='#cc9966') mapandle.drawparallels(np.arange(ltmin,ltmax,2),labels=[1,0,0,0]) mapandle.drawmeridians(np.arange(lgmin,lgmax,2),labels=[0,0,1,0]) graph = FigureCanvasTkAgg(figandle, master=MainBox) canvas = graph.get_tk_widget() canvas.place(x=500, y= 500, anchor=CENTER)
A l'exécution j'obtiens le message suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 def showmat(MainBox,mat2plot): mat2plot = np.array(mat2plot) if mat2plot.any(): mapandle.pcolormesh(lgGrid, ltGrid, mat2plot, latlon=True, cmap= 'PuBu', shading='gouraud', vmin=0, vmax=30) figandle.colorbar(mapandle, location='bottom') #mapandle.colorbar(location='right') graph = FigureCanvasTkAgg(figandle, master=MainBox) canvas = graph.get_tk_widget() canvas.place(x=500, y=500, anchor=CENTER) else: showinfo("alerte", "matrice vide")
Je sollicite votre aide.mappable.autoscale_None() AttributeError: 'Basemap' object has no attribute 'autoscale_None'
D'avance merci.
Partager