python - Place pie charts on a map using Basemap -
i plot pie charts on map using basemap , matplotlib.
do know way this?
you can add axes basemap inset_axes . i've modified first example here include pie chart.
from mpl_toolkits.basemap import basemap mpl_toolkits.axes_grid1.inset_locator import inset_axes import matplotlib.pyplot plt # setup lambert conformal basemap. fig = plt.figure() ax = fig.add_subplot(111) m = basemap(width=12000000,height=9000000,projection='lcc', resolution='c',lat_1=45.,lat_2=55,lat_0=50,lon_0=-107.,ax=ax) # draw coastlines. m.drawcoastlines() # draw boundary around map, fill background. # background end being ocean color, since # continents drawn on top. m.drawmapboundary(fill_color='aqua') # fill continents, set lake color same ocean color. m.fillcontinents(color='coral',lake_color='aqua') axin = inset_axes(m.ax,width="30%",height="30%", loc=3) axin.pie([100,200,3000]) plt.show()
Comments
Post a Comment