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


Python cbook.ls_mapper方法代码示例

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


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

示例1: set_linestyle

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import ls_mapper [as 别名]
def set_linestyle(self, ls):
        """
        Set the linestyle(s) for the collection.

        ACCEPTS: ['solid' | 'dashed', 'dashdot', 'dotted' |
        (offset, on-off-dash-seq) ]
        """
        try:
            dashd = backend_bases.GraphicsContextBase.dashd
            if cbook.is_string_like(ls):
                if ls in dashd:
                    dashes = [dashd[ls]]
                elif ls in cbook.ls_mapper:
                    dashes = [dashd[cbook.ls_mapper[ls]]]
                else:
                    raise ValueError()
            elif cbook.iterable(ls):
                try:
                    dashes = []
                    for x in ls:
                        if cbook.is_string_like(x):
                            if x in dashd:
                                dashes.append(dashd[x])
                            elif x in cbook.ls_mapper:
                                dashes.append(dashd[cbook.ls_mapper[x]])
                            else:
                                raise ValueError()
                        elif cbook.iterable(x) and len(x) == 2:
                            dashes.append(x)
                        else:
                            raise ValueError()
                except ValueError:
                    if len(ls) == 2:
                        dashes = ls
                    else:
                        raise ValueError()
            else:
                raise ValueError()
        except ValueError:
            raise ValueError('Do not know how to convert %s to dashes' % ls)
        self._linestyles = dashes 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:43,代码来源:collections.py

示例2: validate_webagg_address

# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import ls_mapper [as 别名]
def validate_webagg_address(s):
    if s is not None:
        import socket
        try:
            socket.inet_aton(s)
        except socket.error as e:
            raise ValueError("'webagg.address' is not a valid IP address")
        return s
    raise ValueError("'webagg.address' is not a valid IP address")

# A validator dedicated to the named line styles, based on the items in
# ls_mapper, and a list of possible strings read from Line2D.set_linestyle 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:14,代码来源:rcsetup.py


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