__init__.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:geoplot 作者: rl-institut 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号