当前位置: 首页>>代码示例>>Python>>正文


Python LineCollection.set_facecolors方法代码示例

本文整理汇总了Python中matplotlib.collections.LineCollection.set_facecolors方法的典型用法代码示例。如果您正苦于以下问题:Python LineCollection.set_facecolors方法的具体用法?Python LineCollection.set_facecolors怎么用?Python LineCollection.set_facecolors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.collections.LineCollection的用法示例。


在下文中一共展示了LineCollection.set_facecolors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_data

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
def add_data(globe, axes, color_dict):
    """Add shapefile polygons to the matplotlib axes"""
    file_object = shapefile.Reader(filename)
    shapes = file_object.shapes()
    records = file_object.records()
    #iterate over all but the first 20 polygons (they're junk)
    for record, shape in zip(records[20:],shapes[20:]):
        #this entry is the colour code
        description = record[6]
        lons,lats = zip(*shape.points)
        #transform the lat/long coords to the right projection
        data = np.array(globe(lons, lats)).T
        #shapefile shapes can have disconnected parts, we have
        #to check
        if len(shape.parts) == 1:
            segs = [data,]
        else:
            segs = []
            for i in range(1,len(shape.parts)):
                #add all the parts
                index = shape.parts[i-1]
                index2 = shape.parts[i]
                segs.append(data[index:index2])
            segs.append(data[index2:])
        #Add all the parts we've found as a set of lines
        lines = LineCollection(segs,antialiaseds=(1,))
        lines.set_facecolors(color_dict[description])
        lines.set_edgecolors('k')
        lines.set_linewidth(0.1)
        #add the collection to the active axes
        axes.add_collection(lines)
开发者ID:NICTA,项目名称:fsdf-hackfest,代码行数:33,代码来源:demo_shapefile.py

示例2: addShape

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
def addShape(shapefilename, lw=0.0):

    r = shapefile.Reader(shapefilename)
    shapes = r.shapes()
    records = r.records()

    cnt = 0
    for record, shape in zip(records, shapes):
        print(cnt)

        lons,lats = zip(*shape.points)
        data = np.array(m(lons, lats)).T

        if len(shape.parts) == 1:
            segs = [data,]
        else:
            segs = []
            for i in range(1,len(shape.parts)):
                index = shape.parts[i-1]
                index2 = shape.parts[i]
                segs.append(data[index:index2])
            segs.append(data[index2:])

        lines = LineCollection(segs,antialiaseds=(1,), zorder=3)
        lines.set_facecolors(np.random.rand(3, 1) * 0.5 + 0.5)
        lines.set_edgecolors('k')
        lines.set_linewidth(lw)
        ax.add_collection(lines)
        cnt += 1
开发者ID:yuejiahua,项目名称:maps,代码行数:31,代码来源:cn_map_cities.py

示例3: plot_view

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
def plot_view(result):
    # Determine bounding box if no clipping boundary was supplied
    if not result['bbox']:
        result['bbox'] = bbox_of_view(result)

    ax = plt.subplot(111)
    # plt.box(on=None)
    m = Basemap(resolution='i',
                projection='merc',
                llcrnrlat=result['bbox']['ymin'],
                urcrnrlat=result['bbox']['ymax'],
                llcrnrlon=result['bbox']['xmin'],
                urcrnrlon=result['bbox']['xmax'],
                lat_ts=(result['bbox']['xmin'] +
                        result['bbox']['xmax']) / 2)
    m.drawcoastlines()

    try:
        for el in result['results']:
            vectors = get_vectors_from_postgis_map(m, loads(el['geom']))
            lines = LineCollection(vectors, antialiaseds=(1, ))
            lines.set_facecolors('black')
            lines.set_edgecolors('white')
            lines.set_linewidth(1)
            ax.add_collection(lines)
        m.fillcontinents(color='coral', lake_color='aqua')
    # If AttributeError assume geom_type 'Point', simply collect all
    # points and perform scatterplot
    except AttributeError:
        xy = m([loads(point['geom']).x for point in result['results']],
               [loads(point['geom']).y for point in result['results']])
        plt.scatter(xy[0], xy[1])

    plt.show()
开发者ID:andneuma,项目名称:rli_python_as_gis,代码行数:36,代码来源:postgis_query_helpers.py

示例4: drawShape

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
def drawShape(m, ax, paraTable):
    for conshpfn in paraTable["ShapeFile"].unique():
        for i, conShape in enumerate(getPointArray(conshpfn)):
            tempParaTable = concat([paraTable[paraTable["ShapeFile"]==conshpfn]], ignore_index = True)
            partLimit = tempParaTable.ix[i,"PartLimit"]
            normal = tempParaTable.ix[i,"Normal"]
            shpsegs = []
            for j, conShapePart in enumerate(conShape):
                if j < partLimit:
                    lons, lats = zip(*conShapePart)
                    x, y = m(lons, lats)
                    shpsegs.append(zip(x,y))
                    lines = LineCollection(shpsegs,antialiaseds=(1,))
                    lines.set_facecolors(cm.gray(1 - normal))
                    lines.set_linewidth(0.01)
                    ax.add_collection(lines)
开发者ID:baohx,项目名称:ChinaMap,代码行数:18,代码来源:chinamap.py

示例5: plot_countries

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
def plot_countries(countries, world):
    if type(countries) != list:
        countries = [countries]
    ax = plt.subplot(111)
    m = get_region_map(countries, world)
    for country in countries:
        shpsegs = []
        for ring in country['SHAPE']:
            x, y = geo2map_coord(ring, m)
            shpsegs.append(zip(x,y))
        lines = LineCollection(shpsegs,antialiaseds=(1,))
        lines.set_facecolors(cm.jet(np.random.rand(1)))
        lines.set_edgecolors('k')
        #lines.set_linewidth(0.3)
        ax.add_collection(lines)
    plt.show()
开发者ID:jardon-u,项目名称:miniprojs,代码行数:18,代码来源:geomap.py

示例6: algo

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
def algo (region,output, word):
    reg = [0 for i in range(0,23)]
    total = 0
    for line in region: #reg_num number
        items = line.rstrip('\n').split('\t')
        reg[int(items[0])]=int(items[1])
        total = total+int(items[1])
    reg=np.array(reg)
    max_percent=np.max(reg)
    plt.figure(figsize=(15,15))
    ax = plt.subplot(111)
    m = Basemap(projection='merc', lat_0=45, lon_0=0,
                resolution = 'h', area_thresh = 10.0,
                llcrnrlat=41.33, llcrnrlon=-5,   
                urcrnrlat=51.5, urcrnrlon=9.7) 
    m.drawcoastlines()
    #m.drawcountries()  # french border does not fit with region ones
    m.fillcontinents(color='lightgrey',lake_color='white')
    m.drawmapboundary(fill_color='white')

    sf = shapefile.Reader("./geodata/FRA_adm1")
    shapes = sf.shapes()
    records = sf.records()
    for record, shape in zip(records,shapes):
        lons,lats = zip(*shape.points)
        data = np.array(m(lons, lats)).T
        if len(shape.parts) == 1:
            segs = [data,]
        else:
            segs = []
            for i in range(1,len(shape.parts)):
                index = shape.parts[i-1]
                index2 = shape.parts[i]
                segs.append(data[index:index2])
            segs.append(data[index2:])
        
        lines = LineCollection(segs,antialiaseds=(1,))
        lines.set_edgecolors('k')
        lines.set_linewidth(0.5)
        lines.set_facecolors('brown')
        lines.set_alpha(float(reg[record[3]])/max_percent) #record[3] est le numero de region
        ax.add_collection(lines)   

    plt.savefig(word+'-'+str(total)+'.png',dpi=300)

    return 0
开发者ID:yleo,项目名称:MapGeoByFrenchRegions,代码行数:48,代码来源:plot_word_region.py

示例7: plot

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
    def plot(self, ax=None, cmapname=None, cmap=None, linewidth=1,
             edgecolor='grey', facecolor=None, alpha=1):
        """Plot the geometries on the basemap using the defined colors

        Parameters:
        -----------
        ax : matplotlib.axis object
            An axis object for plots. Overwrites the self.ax attribute.
        cmapname : string
            Name of the color map from matplotlib (LINK!) (default: 'seismic')
        cmap : matplotlib colormap
            You can create you own colormap and pass it to the plot.
        linewidth : float
            Width of the lines.
        edgecolor : string, float or iterable
            Definition of the edge color. Can be an iterable with a color
            definition for each geometry, a string with one color for
            all geometries or a float to define one color for all geometries
            from the cmap.
        facecolor : string, float or iterable
            Definition of the face color. See edgecolor.
        alpha : float
            Level of transparency.
        """
        if ax is not None:
            self.ax = ax
        n = 0
        if facecolor is None:
            facecolor = self.color
        if edgecolor is None:
            edgecolor = self.color
        if cmapname is not None:
            self.cmapname = cmapname
        if self.data is not None:
            self.data = np.array(self.data)
        if cmap is None:
            cmap = plt.get_cmap(self.cmapname)
        for geo in self.geometries:
            vectors = self.get_vectors_from_postgis_map(geo)
            lines = LineCollection(vectors, antialiaseds=(1, ))
            lines.set_facecolors(self.select_color(facecolor, cmap, n))
            lines.set_edgecolors(self.select_color(edgecolor, cmap, n))
            lines.set_linewidth(linewidth)
            lines.set_alpha(alpha)
            self.ax.add_collection(lines)
            n += 1
开发者ID:rl-institut,项目名称:geoplot,代码行数:48,代码来源:__init__.py

示例8: _collect_geoms

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
    def _collect_geoms(self, query_object, ax, m, el_limit=5000):
        """
        Create vectors for different geom and multi-geom types
        :rtype: subplot
        :param query_object:
        :param ax: Instance of plot.subplot()
        :param m: Instance of Basemap()
        :param el_limit: Maximum number of elements to display on map
        :return: subplot instance
        """
        # Collect fetched geometries
        if not len(query_object.results) > el_limit:
            try:
                for el in query_object.results:
                    vectors = query_object._get_vectors_from_postgis_map(m,
                                                                         loads(
                                                                             el[
                                                                                 'geom']))
                    lines = LineCollection(vectors, antialiaseds=(1,))
                    if not query_object.geom_type == 'LineString':
                        lines.set_facecolors('red')
                    lines.set_linewidth(0.25)
                    ax.add_collection(lines)
            # If AttributeError assume geom_type 'Point', simply collect all
            # points and perform scatterplot
            except AttributeError:
                xy = m(
                    [loads(point['geom']).x for point in query_object.results],
                    [loads(point['geom']).y for point in query_object.results])
                ax.scatter(xy[0], xy[1])

                # # Add clipping border
                # if self.region.boundary_polygon:
                #     vectors = self.__get_vectors_from_postgis_map(m, loads(
                #         self.region.boundary_polygon))
                #     border = LineCollection(vectors, antialiaseds=(1,))
                #     border.set_edgecolors('black')
                #     border.set_linewidth(1)
                #     border.set_linestyle('dashed')
                #     ax.add_collection(border)

        else:
            logger.printmessage.error("Error: >5000 elements to plot!")

        return ax
开发者ID:andneuma,项目名称:rli_python_as_gis,代码行数:47,代码来源:PostGISHelpers.py

示例9: drawcountry

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
 def drawcountry(self,
                 ax,
                 base_map,
                 iso2,
                 color,
                 alpha = 1):
     if iso2 not in self.countries:
         raise ValueError, "Where is that country ?"
     vertices = self.countries[iso2]
     shape = []
     for vertex in vertices:
         longs, lats = zip(*vertex)
         # conversion to plot coordinates
         x,y = base_map(longs, lats)
         shape.append(zip(x,y))
     lines = LineCollection(shape,antialiaseds=(1,))
     lines.set_facecolors(cm.hot(np.array([color,])))
     lines.set_edgecolors('white')
     lines.set_linewidth(0.5)
     lines.set_alpha(alpha)
     ax.add_collection(lines)
开发者ID:HESFIRE,项目名称:ssh-attack-visualisation,代码行数:23,代码来源:ssh-plot.py

示例10: map_communities_and_commutes

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
def map_communities_and_commutes(G):
    
    G_mod = nx.read_gml("/home/sscepano/D4D res/allstuff/User movements graphs/commuting patterns/1/total_commuting_G_scaled_weights_11COM_713_7115.gml")
    
    col = [str]*256
    for i in range(256):
        col[i] = 'w'
    
    for node in G_mod.nodes_iter(data=True):
        #print node[1]['label']
        col_gephi = node[1]['graphics']['fill']
        while (len(col_gephi) < 7):
            col_gephi += '0'
        subpref_gephi = int(float(node[1]['label']))
        print subpref_gephi, col_gephi
        col[subpref_gephi] = col_gephi   
    #print col
    
    plt.clf()
    plt.subplots_adjust(left=0.05,right=0.95,top=0.90,bottom=0.05,wspace=0.15,hspace=0.05)
    ax = plt.subplot(111)
    
    m = Basemap(llcrnrlon=-9, \
                llcrnrlat=3.8, \
                urcrnrlon=-1.5, \
                urcrnrlat = 11, \
                resolution = 'h', \
                projection = 'tmerc', \
                lat_0 = 7.38, \
                lon_0 = -5.30)
   
    # read the shapefile archive
    s = m.readshapefile('/home/sscepano/DATA SET7S/D4D/SubPrefecture/GEOM_SOUS_PREFECTURE', 'subpref')
    
    from shapelib import ShapeFile
    import dbflib
    from matplotlib.collections import LineCollection
    from matplotlib import cm
    
    shp = ShapeFile(r'/home/sscepano/DATA SET7S/D4D/SubPrefecture/GEOM_SOUS_PREFECTURE')
    dbf = dbflib.open(r'/home/sscepano/DATA SET7S/D4D/SubPrefecture/GEOM_SOUS_PREFECTURE')
    
    for npoly in range(shp.info()[0]):
        shpsegs = []
        shpinfo = []  
        shp_object = shp.read_object(npoly)
        verts = shp_object.vertices()
        rings = len(verts)
        for ring in range(rings):
            lons, lats = zip(*verts[ring])
            x, y = m(lons, lats)
            shpsegs.append(zip(x,y))
            if ring == 0:
                shapedict = dbf.read_record(npoly)
            #print shapedict
            name = shapedict["ID_DEPART"]
            subpref_id = shapedict["ID_SP"]
            # add information about ring number to dictionary.
            shapedict['RINGNUM'] = ring+1
            shapedict['SHAPENUM'] = npoly+1
            shpinfo.append(shapedict)
        #print subpref_id
        #print name
        lines = LineCollection(shpsegs,antialiaseds=(1,))
        lines.set_facecolors(col[subpref_id])
        lines.set_edgecolors('gray')
        lines.set_linewidth(0.3)
        ax.add_collection(lines)
    
    m.drawcoastlines()
    
    plt.show()

#    # data to plot on the map    
#    lons = [int]*256
#    lats = [int]*256
#    
#    # read in coordinates fo subprefs
#    file_name2 = "/home/sscepano/DATA SET7S/D4D/SUBPREF_POS_LONLAT.TSV"
#    f2 = open(file_name2, 'r')
#    
#    # read subpref coordinates
#    subpref_coord = {}
#    for line in f2:
#        subpref_id, lon, lat = line.split('\t')
#        lon = float(lon)
#        lat = float(lat)
#        subpref_id = int(subpref_id)
#        subpref_coord.keys().append(subpref_id)
#        subpref_coord[subpref_id] = (lon, lat)
#    
#    f2.close()
#    
#    # if wanna plot number of users whose this is home subpref
#    for subpref in range(1,256):
#        lons[subpref] = subpref_coord[subpref][0]
#        lats[subpref] = subpref_coord[subpref][1]
#    
#    
#    if G.has_node(-1): 
#.........这里部分代码省略.........
开发者ID:sanja7s,项目名称:SET37s,代码行数:103,代码来源:save_graph_data.py

示例11: len

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
    rings = len(verts)
    for ring in range(rings):
        lons, lats = zip(*verts[ring])
#        if max(lons) > 721. or min(lons) < -721. or max(lats) > 91. or min(lats) < -91:
#            raise ValueError,msg
        x, y = m(lons, lats)
        shpsegs.append(zip(x,y))
        if ring == 0:
            shapedict = dbf.read_record(npoly)
        #print shapedict
        name = shapedict["ID_DEPART"]
        subpref_id = shapedict["ID_SP"]
        #color_col
        
        # add information about ring number to dictionary.
        shapedict['RINGNUM'] = ring+1
        shapedict['SHAPENUM'] = npoly+1
        shpinfo.append(shapedict)
    #print subpref_id
    #print name
    lines = LineCollection(shpsegs,antialiaseds=(1,))
    lines.set_facecolors(col[subpref_id])
    lines.set_edgecolors('k')
    lines.set_linewidth(0.3)
    ax.add_collection(lines)
    
plt.savefig('/home/sscepano/D4D res/allstuff/simple dynamics/v1/cleaned_mod_v1.png',dpi=1000)
#plt.show()

###################################################################################################3
            
开发者ID:sanja7s,项目名称:SET37s,代码行数:32,代码来源:map_modular_classes.py

示例12: plot_gspan_res

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
def plot_gspan_res(G, subpref_id, color_val):
    
    fig = plt.figure(subpref_id)
    #Custom adjust of the subplots
    plt.subplots_adjust(left=0.05,right=0.95,top=0.90,bottom=0.05,wspace=0.15,hspace=0.05)
    ax = plt.subplot(111)
    
    m = Basemap(llcrnrlon=-9, \
                llcrnrlat=3.8, \
                urcrnrlon=-1.5, \
                urcrnrlat = 11, \
                resolution = 'h', \
                projection = 'tmerc', \
                lat_0 = 7.38, \
                lon_0 = -5.30)
   
    # read the shapefile archive
    s = m.readshapefile('/home/sscepano/DATA SET7S/D4D/SubPrefecture/GEOM_SOUS_PREFECTURE', 'subpref')
    
    m.drawcoastlines()
    
    shp = ShapeFile(r'/home/sscepano/DATA SET7S/D4D/SubPrefecture/GEOM_SOUS_PREFECTURE')
    dbf = dbflib.open(r'/home/sscepano/DATA SET7S/D4D/SubPrefecture/GEOM_SOUS_PREFECTURE')
    
    msg = "Out of bounds"
    color_col = []
    
    for npoly in range(shp.info()[0]):
        shpsegs = []
        shpinfo = []
        
        
        shp_object = shp.read_object(npoly)
        verts = shp_object.vertices()
        rings = len(verts)
        for ring in range(rings):
            lons, lats = zip(*verts[ring])
            x, y = m(lons, lats)
            shpsegs.append(zip(x,y))
            if ring == 0:
                shapedict = dbf.read_record(npoly)
            #print shapedict
            name = shapedict["ID_DEPART"]
            subpref_id2 = shapedict["ID_SP"]
            #color_col
            
            # add information about ring number to dictionary.
            shapedict['RINGNUM'] = ring+1
            shapedict['SHAPENUM'] = npoly+1
            shpinfo.append(shapedict)

        lines = LineCollection(shpsegs,antialiaseds=(1,))
        if subpref_id == subpref_id2:
            lines.set_facecolors('g')
        lines.set_edgecolors('k')
        lines.set_linewidth(0.3)
        ax.add_collection(lines)

    # data to plot on the map    
    lons = [int]*256
    lats = [int]*256
    num = []
    
    # read in coordinates fo subprefs
    file_name2 = "/home/sscepano/DATA SET7S/D4D/SUBPREF_POS_LONLAT.TSV"
    f2 = open(file_name2, 'r')
    
    # read subpref coordinates
    subpref_coord = {}
    for line in f2:
        subpref_id, lon, lat = line.split('\t')
        lon = float(lon)
        lat = float(lat)
        subpref_id = int(subpref_id)
        subpref_coord.keys().append(subpref_id)
        subpref_coord[subpref_id] = (lon, lat)
    
    f2.close()
    
    # if wanna plot number of users whose this is home subpref
    for subpref in range(1,256):
        lons[subpref] = subpref_coord[subpref][0]
        lats[subpref] = subpref_coord[subpref][1]
    

    for u, v, d in G.edges(data=True):
        lo = []
        la = []   
        lo.append(lons[u])
        lo.append(lons[v])
        la.append(lats[u])
        la.append(lats[v])
        x, y = m(lo, la)
        m.plot(x,y, color = color_val)


    return plt
开发者ID:sanja7s,项目名称:SET37s,代码行数:99,代码来源:save_graph_data.py

示例13: len

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
    rings = len(verts)
    for ring in range(rings):
        lons, lats = zip(*verts[ring])
        x, y = m(lons, lats)
        shpsegs.append(zip(x,y))
        if ring == 0:
            shapedict = dbf.read_record(npoly)
        print shapedict
        name = shapedict["ID_DEPART"]
        subpref_id = shapedict["ID_SP"]
        num = ["%.2f" % traj[subpref_id]]
#        for name, xc, yc in zip(num, x, y):
#            plt.text(xc, yc, name)
        #color_col
        
        # add information about ring number to dictionary.
        shapedict['RINGNUM'] = ring+1
        shapedict['SHAPENUM'] = npoly+1
        shpinfo.append(shapedict)
    #print subpref_id
    #print name
    lines = LineCollection(shpsegs,antialiaseds=(1,))
    lines.set_facecolors(str(1 - traj[subpref_id]))
    lines.set_edgecolors('k')
    lines.set_linewidth(0.3)
    ax.add_collection(lines)

    
#plt.savefig('/home/sscepano/D4D res/allstuff/CLUSTERING/subpref res/maps/grayscale_pct_home_c_map2.png',dpi=1000)
plt.show()
开发者ID:sanja7s,项目名称:SET37s,代码行数:32,代码来源:map_subprefs_by_pct_home_C.py

示例14: AK

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
shapes = shpf.shapes()
records = shpf.records()
 
# show only CA and AK (for example)
for record, shape in zip_filter_by_state(records, shapes, ['06', '02']):
    lons,lats = zip(*shape.points)
    data = np.array(m(lons, lats)).T
 
    if len(shape.parts) == 1:
        segs = [data,]
    else:
        segs = []
        for i in range(1,len(shape.parts)):
            index = shape.parts[i-1]
            index2 = shape.parts[i]
            segs.append(data[index:index2])
        segs.append(data[index2:])
 
    lines = LineCollection(segs,antialiaseds=(1,))
    lines.set_facecolors(cm.jet(np.random.rand(1)))
    lines.set_edgecolors('k')
    lines.set_linewidth(0.1)
    ax.add_collection(lines)
 
plt.savefig('tutorial10.png',dpi=300)
plt.show()

# <codecell>


开发者ID:Clyde-fare,项目名称:working-open-data,代码行数:30,代码来源:Day_22_mapping_counties.py

示例15: len

# 需要导入模块: from matplotlib.collections import LineCollection [as 别名]
# 或者: from matplotlib.collections.LineCollection import set_facecolors [as 别名]
    rings = len(verts)
    for ring in range(rings):
        lons, lats = zip(*verts[ring])
        x, y = m(lons, lats)
        shpsegs.append(zip(x,y))
        if ring == 0:
            shapedict = dbf.read_record(npoly)
        print shapedict
        name = shapedict["ID_DEPART"]
        subpref_id = shapedict["ID_SP"]
        num = ["%.2f" % rg[subpref_id]]
#        for name, xc, yc in zip(num, x, y):
#            plt.text(xc, yc, name)
        #color_col
        
        # add information about ring number to dictionary.
        shapedict['RINGNUM'] = ring+1
        shapedict['SHAPENUM'] = npoly+1
        shpinfo.append(shapedict)
    #print subpref_id
    #print name
    lines = LineCollection(shpsegs,antialiaseds=(1,))
    lines.set_facecolors(str(1 - rg[subpref_id]))
    lines.set_edgecolors('k')
    lines.set_linewidth(0.3)
    ax.add_collection(lines)

    
plt.savefig('/home/sscepano/D4D res/allstuff/rg/grayscale_rg_map.png',dpi=1000)
#plt.show()
开发者ID:sanja7s,项目名称:SET37s,代码行数:32,代码来源:map_subprefs.py


注:本文中的matplotlib.collections.LineCollection.set_facecolors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。