Today there is a good alternative to the base map. Mplleaflet is a library inspired by mpld3. It works faster than the base map, is easier to use and allows you to visualize geographic data on a beautiful interactive openstreetmap. The input can be longitude and latitude, the library automatically designs data correctly.
The pos input dictionary, where node (country) is the key, and long armor is stored as a value.
pos = {u'Afghanistan': [66.00473365578554, 33.83523072784668], u'Aland': [19.944009818523348, 60.23133494165451], u'Albania': [20.04983396108883, 41.14244989474517], u'Algeria': [2.617323009197829, 28.158938494487625], .....
Setting up is as simple as:
import mplleaflet fig, ax = plt.subplots() nx.draw_networkx_nodes(GG,pos=pos,node_size=10,node_color='red',edge_color='k',alpha=.5, with_labels=True) nx.draw_networkx_edges(GG,pos=pos,edge_color='gray', alpha=.1) nx.draw_networkx_labels(GG,pos, label_pos =10.3) mplleaflet.display(fig=ax.figure)
Philip schwarz
source share