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


Python descartes.PolygonPatch方法代码示例

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


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

示例1: plot_filled_polygons

# 需要导入模块: import descartes [as 别名]
# 或者: from descartes import PolygonPatch [as 别名]
def plot_filled_polygons(self,polygons, facecolour='green', edgecolour='black', linewidth=1, alpha=0.5):
        """
        This function plots a series of shapely polygons but fills them in

        Args:
            ax_list: list of axes
            polygons: list of shapely polygons

        Author: FJC
        """
        from shapely.geometry import Polygon
        from descartes import PolygonPatch
        from matplotlib.collections import PatchCollection

        print('Plotting the polygons...')

        #patches = []
        for key, poly in polygons.items():
            this_patch = PolygonPatch(poly, fc=facecolour, ec=edgecolour, alpha=alpha)
            self.ax_list[0].add_patch(this_patch) 
开发者ID:LSDtopotools,项目名称:LSDMappingTools,代码行数:22,代码来源:PlottingRaster.py

示例2: PlotPolygons

# 需要导入模块: import descartes [as 别名]
# 或者: from descartes import PolygonPatch [as 别名]
def PlotPolygons(Polygons, Map=None, Ax=None, OutlineColour='k', FillColour='w', ColourMap="None", alpha=0.5):

    """
    Function to plot polygons from a shapely Polygon Dictionary

    Modified from PlottingRaster.py code by FJC

    Outline colour can be name, tuple or range of value to shade

    MDH

    """

    #create a figure if one doesnt already exist?
    if Ax == None:
        print("PlotPolygons: Warning, no axes provided, creating new figure and axes")
        Fig = plt.figure()
        Ax = plt.gca()
        plt.axis('equal')
        plt.xlabel('Longitude ($^o$)')
        plt.ylabel('Latitude ($^o$)')

    # convert to map coordinates
    if Map != None:
       Polygons = ConvertPolygonsLatLong2MapCoords(Polygons, Map)

    # loop through shapes in polygons and plot patches
    for Key, Poly in Polygons.iteritems():
        if Poly.geom_type == 'Polygon':
            Patch = PolygonPatch(Poly,fc=FillColour,ec=OutlineColour,alpha=alpha)
            Ax.add_patch(Patch)
        elif Poly.geom_type == 'MultiPolygon':
            for singlepoly in Poly:
                Patch = PolygonPatch(singlepoly,fc=FillColour,ec=OutlineColour,alpha=alpha)
                Ax.add_patch(Patch)

    if Ax == None:
        Ax.autoscale_view() 
开发者ID:LSDtopotools,项目名称:LSDMappingTools,代码行数:40,代码来源:rotated_mapping_tools.py

示例3: plot_polygon

# 需要导入模块: import descartes [as 别名]
# 或者: from descartes import PolygonPatch [as 别名]
def plot_polygon(ax,polygon):
    # fig = plt.figure(figsize=(10,10))
    # ax = fig.add_subplot(111)
    # margin = .3
    # x_min, y_min, x_max, y_max = polygon.bounds
    # ax.set_xlim([x_min-margin, x_max+margin])
    # ax.set_ylim([y_min-margin, y_max+margin])
    patch = PolygonPatch(polygon, fc='#999999',
                         ec='#000000', fill=True,
                         zorder=-1)
    ax.add_patch(patch)
    return 
开发者ID:zooniverse,项目名称:aggregation,代码行数:14,代码来源:whales.py

示例4: plot_polygon

# 需要导入模块: import descartes [as 别名]
# 或者: from descartes import PolygonPatch [as 别名]
def plot_polygon(polygon):
    fig = pl.figure(figsize=(10, 10))
    ax = fig.add_subplot(111)
    margin = .3

    print(polygon)

    x_min, y_min, x_max, y_max = polygon.bounds
    ax.set_xlim([x_min - margin, x_max + margin])
    ax.set_ylim([y_min - margin, y_max + margin])
    patch = PolygonPatch(polygon, fc='#999999',
                         ec='#000000', fill=True,
                         zorder=-1)
    ax.add_patch(patch)
    return fig 
开发者ID:GeoPyTool,项目名称:GeoPyTool,代码行数:17,代码来源:Alpah_Shape_2D.py


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