예제 #1
0
def main():
    color_dict = load_colors()
    globe, axes, fig = setup_axes()
    add_data(globe, axes, color_dict)
    globe.drawmapboundary(fill_color='#1C4E63')
    globe.fillcontinents(color='#63561B',lake_color='#1C4E63')
    #write the result out to a file
    headlessmpl.figure_to_file(fig, "shapefile.png")
예제 #2
0
filename = "demo_1.png"
#image resolution
width = 1920
height = 1080

#bounds of the map
low_long = -180
high_long = 180
low_lat = -90
high_lat = 90

#create a new headless figure
fig = headlessmpl.figure(width, height)
axes = fig.add_subplot(111)

#create a basemap object with a cylindrical projection
m = Basemap(projection='cyl', llcrnrlon=low_long,
        llcrnrlat=low_lat, urcrnrlon=high_long, urcrnrlat=high_lat,
        resolution = 'h', area_thresh =1000, ax=axes)

#draw some boundaries etc
m.drawcoastlines()
m.fillcontinents()
m.drawcountries(linewidth=0.5)
m.drawmapboundary(fill_color='#1C4E63')
m.fillcontinents(color='#63561B',lake_color='#1C4E63')

#write the resultant map to a file
headlessmpl.figure_to_file(fig, filename)