def draw_networkx_nodes(G, pos,
                        nodelist=None,
                        node_size=300,
                        node_color='r',
                        node_shape='o',
                        alpha=1.0,
                        cmap=None,
                        vmin=None,
                        vmax=None,
                        ax=None,
                        linewidth=None,
                        zorder=None,
                        **kwds):
    """Draw the nodes of the graph G.

    This draws only the nodes of the graph G.

    Parameters
    ----------
    G : graph
       A networkx graph

    pos : dictionary
       A dictionary with nodes as keys and positions as values.
       If not specified a spring layout positioning will be computed.
       See networkx.layout for functions that compute node positions.

    ax : Matplotlib Axes object, optional
       Draw the graph in the specified Matplotlib axes.

    nodelist: list, optional
       Draw only specified nodes (default G.nodes())

    edgelist: list
       Draw only specified edges(default=G.edges())

    node_size: scalar or array
       Size of nodes (default=300).  If an array is specified it must be the
       same length as nodelist.

    node_color: color string, or array of floats
       Node color. Can be a single color format string (default='r'),
       or a  sequence of colors with the same length as nodelist.
       If numeric values are specified they will be mapped to
       colors using the cmap and vmin,vmax parameters.  See
       matplotlib.scatter for more details.

    node_shape:  string
       The shape of the node.  Specification is as matplotlib.scatter
       marker, one of 'so^>v<dph8' (default='o').

    alpha: float
       The node transparency (default=1.0)

    cmap: Matplotlib colormap
       Colormap for mapping intensities of nodes (default=None)

    vmin,vmax: floats
       Minimum and maximum for node colormap scaling (default=None)

    width`: float
       Line width of edges (default =1.0)


    Notes
    -----
    Any keywords not listed above are passed through to Matplotlib's
    scatter function.

    Examples
    --------
    >>> G=nx.dodecahedral_graph()
    >>> nodes=nx.draw_networkx_nodes(G,pos=nx.spring_layout(G))

    Also see the NetworkX drawing examples at
    http://networkx.lanl.gov/gallery.html

    See Also
    --------
    draw()
    draw_networkx()
    draw_networkx_edges()
    draw_networkx_labels()
    draw_networkx_edge_labels()



    """
    try:
        import matplotlib.pylab as pylab
        import numpy
    except __HOLE__:
        raise ImportError("Matplotlib required for draw()")
    except RuntimeError:
        print("Matplotlib unable to open display")
        raise

    if zorder is None:
        zorder = 2

    if ax is None:
        ax=pylab.gca()

    if nodelist is None:
        nodelist=G.nodes()

    if not nodelist or len(nodelist)==0:  # empty nodelist, no drawing
        return None

    try:
        xy=numpy.asarray([pos[v] for v in nodelist])
    except KeyError as e:
        raise nx.NetworkXError('Node %s has no position.'%e)
    except ValueError:
        raise nx.NetworkXError('Bad value in node positions.')

    syms =  { # a dict from symbol to (numsides, angle)
            's' : (4,math.pi/4.0,0),   # square
            'o' : (0,0,3),            # circle
            '^' : (3,0,0),             # triangle up
            '>' : (3,math.pi/2.0,0),   # triangle right
            'v' : (3,math.pi,0),       # triangle down
            '<' : (3,3*math.pi/2.0,0), # triangle left
            'd' : (4,0,0),             # diamond
            'p' : (5,0,0),             # pentagram
            'h' : (6,0,0),             # hexagon
            '8' : (8,0,0),             # octagon
            '+' : (4,0,0),             # plus
            'x' : (4,math.pi/4.0,0)    # cross
            }

    temp_x = [p[0] for p in list(pos.values())]
    temp_y = [p[1] for p in list(pos.values())]
    minx = np.amin(temp_x)
    maxx = np.amax(temp_x)
    miny = np.amin(temp_y)
    maxy = np.amax(temp_y)

    w = max(maxx-minx,1.0)
    h = max(maxy-miny,1.0)
    #for scaling

    area2radius = lambda a: math.sqrt((a*w*h)/(ax.figure.get_figheight()*ax.figure.get_figwidth()*ax.figure.dpi*ax.figure.dpi*math.pi*.75*.75))

    if cb.iterable(node_size):
        try:
            vals = list(node_size.values())
        except:
            vals = node_size
        node_size = dict(list(zip(nodelist,list(map(area2radius,vals)))))
    else:
        node_size = {}.fromkeys(nodelist,area2radius(node_size))
    for n in node_size:
        if node_size[n] == 0.0:
            node_size[n] = .00001

    if cmap is None:
        cmap = cm.get_cmap(mpl.rcParams['image.cmap'])

    n_colors = get_color_dict(node_color,nodelist,vmin,vmax,cmap)

    sym = syms[node_shape]
    numsides,rotation,symstyle=syms[node_shape]

    node_patches = {}
    for n in nodelist:
        if symstyle==0:
            node_patches[n] = patches.RegularPolygon(pos[n],
                                                     numsides,
                                                     orientation=rotation,
                                                     radius=node_size[n],
                                                     facecolor=n_colors[n],
                                                     edgecolor='k',
                                                     alpha=alpha,
                                                     linewidth=linewidth,
                                                     transform=ax.transData,
                                                     zorder=zorder)


        elif symstyle==3:
            node_patches[n] = patches.Circle(pos[n],
                                             radius=node_size[n],
                                             facecolor=n_colors[n],
                                             edgecolor='k',
                                             alpha=alpha,
                                             linewidth=linewidth,
                                             transform=ax.transData,
                                             zorder=zorder)
        ax.add_patch(node_patches[n])




    # the pad is a little hack to deal with the fact that we don't
    # want to transform all the symbols whose scales are in points
    # to data coords to get the exact bounding box for efficiency
    # reasons.  It can be done right if this is deemed important
    temp_x = xy[:,0]
    temp_y = xy[:,1]
    minx = np.amin(temp_x)
    maxx = np.amax(temp_x)
    miny = np.amin(temp_y)
    maxy = np.amax(temp_y)

    w = maxx-minx
    h = maxy-miny
    padx, pady = 0.05*w, 0.05*h
    corners = (minx-padx, miny-pady), (maxx+padx, maxy+pady)
    ax.update_datalim(corners)
#    ax.autoscale()
    ax.autoscale_view()
    ax.set_aspect('equal')
#   pylab.axes(ax)
    #pylab.sci(node_collection)
    #node_collection.set_zorder(2)
    return node_patches
dataset/ETHPy150Open calliope-project/calliope/calliope/lib/nx_pylab.py/draw_networkx_nodes