deepgraph.DeepGraph.plot_map
- DeepGraph.plot_map(lon, lat, edges=False, C=None, C_split_0=None, kwds_basemap=None, kwds_scatter=None, kwds_quiver=None, kwds_quiver_0=None, ax=None, m=None)[source]
Plot nodes and corresponding edges on a basemap.
Create a scatter plot of the nodes in
vand optionally a quiver plot of the corresponding edges ineon ampl_toolkits.basemap.Basemapinstance.The coordinates of the scatter plot are determined by the node’s longitudes and latitudes (in degrees):
v[lon]andv[lat], wherelonandlatare column names ofv(the arrow’s coordinates are determined automatically).In order to map colors to the arrows, either
CorC_split_0can be be passed, an array of the same length ase. PassingCcreates a single quiver plot (qu). PassingC_split_0creates two separate quiver plots, one for all edges whereC_split_0== 0 (qu_0), and one for all other edges (qu). By default, the arrows of qu_0 have no head, indicating “undirected” edges. This can be useful, for instance, whenC_split_0represents an array of temporal distances.In order to control the parameters of the basemap, scatter, quiver and/or quiver_0 plots, one may pass keyword arguments by setting
kwds_basemap,kwds_scatter,kwds_quiverand/orkwds_quiver_0.Can be used iteratively by passing
axand/orm.- Parameters:
lon (int or str) – A column name of
v. The corresponding values must be longitudes in degrees.lat (int or str) – A column name of
v. The corresponding values must be latitudes in degrees.edges (bool, optional (default=True)) – Whether to create a quiver plot (2-D field of arrows) of the edges between the nodes.
C (array_like, optional (default=None)) – An optional array used to map colors to the arrows. Must have the same length es
e. Has no effect ifC_split_0is passed as an argument.C_split_0 (array_like, optional (default=None)) – An optional array used to map colors to the arrows. Must have the same length es
e. If this parameter is passed,Chas no effect, and two separate quiver plots are created (qu and qu_0).kwds_basemap (dict, optional (default=None)) – kwargs passed to basemap.
kwds_scatter (dict, optional (default=None)) – kwargs to be passed to scatter.
kwds_quiver (dict, optional (default=None)) – kwargs to be passed to quiver (qu).
kwds_quiver_0 (dict, optional (default=None)) – kwargs to be passed to quiver (qu_0). Only has an effect if
C_split_0has been set.ax (matplotlib axes object, optional (default=None)) – An axes instance to use.
m (Basemap object, optional (default=None)) – A mpl_toolkits.basemap.Basemap instance to use.
- Returns:
obj – If
C_split_0has been passed, return a dict of matplotlib objects with the following keys: [‘fig’, ‘ax’, ‘m’, ‘pc’, ‘qu’, ‘qu_0’]. Otherwise, return a dict with keys: [‘fig’, ‘ax’, ‘m’, ‘pc’, ‘qu’].- Return type:
dict
Notes
When passing
C_split_0, the color of the arrows in qu_0 can be set by passing the keyword argument color tokwds_quiver_0. The color of the arrows in qu, however, are determined byC_split_0.The default drawing order is set to: 1. quiver_0 (zorder=1) 2. quiver (zorder=2) 3. scatter (zorder=3) This order can be changed by setting the
zorderinkwds_quiver_0,kwds_quiverand/orkwds_scatter. See also http://matplotlib.org/examples/pylab_examples/zorder_demo.htmlSee also
plot_map_generator,plot_2d,plot_2d_generator,plot_3d