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


Python matplotlib.__version__方法代码示例

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


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

示例1: add_legend_patch

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def add_legend_patch(self, legend_rows, fontsize=None):
		if matplotlib.__version__ == '3.0.2':
			self.logger.warning('skipping legend patch with matplotlib v3.0.2 for compatibility')
			return
		if self._legend is not None:
			self._legend.remove()
			self._legend = None
		fontsize = fontsize or self.fontsize_scale
		legend_bbox = self.figure.legend(
			tuple(patches.Patch(color=patch_color) for patch_color, _ in legend_rows),
			tuple(label for _, label in legend_rows),
			borderaxespad=1.25,
			fontsize=fontsize,
			frameon=True,
			handlelength=1.5,
			handletextpad=0.75,
			labelspacing=0.3,
			loc='lower right'
		)
		legend_bbox.legendPatch.set_linewidth(0)
		self._legend = legend_bbox 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:23,代码来源:graphs.py

示例2: mpl_hist_arg

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def mpl_hist_arg(value=True):
    """Find the appropriate `density` kwarg for our given matplotlib version.

    This will determine if we should use `normed` or `density`. Additionally,
    since this is a kwarg, the user can supply a value (True or False) that
    they would like in the output dictionary.

    Parameters
    ----------
    value : bool, optional (default=True)
        The boolean value of density/normed

    Returns
    -------
    density_kwarg : dict
        A dictionary containing the appropriate density kwarg for the
        installed  matplotlib version, mapped to the provided or default
        value
    """
    import matplotlib

    density_kwarg = 'density' if matplotlib.__version__ >= '2.1.0'\
        else 'normed'
    return {density_kwarg: value} 
开发者ID:alkaline-ml,项目名称:pmdarima,代码行数:26,代码来源:matplotlib.py

示例3: __getstate__

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def __getstate__(self):
        state = self.__dict__.copy()
        # the axobservers cannot currently be pickled.
        # Additionally, the canvas cannot currently be pickled, but this has
        # the benefit of meaning that a figure can be detached from one canvas,
        # and re-attached to another.
        for attr_to_pop in ('_axobservers', 'show',
                            'canvas', '_cachedRenderer'):
            state.pop(attr_to_pop, None)

        # add version information to the state
        state['__mpl_version__'] = _mpl_version

        # check to see if the figure has a manager and whether it is registered
        # with pyplot
        if getattr(self.canvas, 'manager', None) is not None:
            manager = self.canvas.manager
            import matplotlib._pylab_helpers
            if manager in matplotlib._pylab_helpers.Gcf.figs.values():
                state['_restore_to_pylab'] = True

        return state 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:24,代码来源:figure.py

示例4: _iter_path_collection

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def _iter_path_collection(paths, path_transforms, offsets, styles):
        """Build an iterator over the elements of the path collection"""
        N = max(len(paths), len(offsets))

        # Before mpl 1.4.0, path_transform can be a false-y value, not a valid
        # transformation matrix.
        if LooseVersion(mpl.__version__) < LooseVersion('1.4.0'):
            if path_transforms is None:
                path_transforms = [np.eye(3)]

        edgecolor = styles['edgecolor']
        if np.size(edgecolor) == 0:
            edgecolor = ['none']
        facecolor = styles['facecolor']
        if np.size(facecolor) == 0:
            facecolor = ['none']

        elements = [paths, path_transforms, offsets,
                    edgecolor, styles['linewidth'], facecolor]

        it = itertools
        return it.islice(py3k.zip(*py3k.map(it.cycle, elements)), N) 
开发者ID:mpld3,项目名称:mplexporter,代码行数:24,代码来源:base.py

示例5: test_image

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def test_image():
    # Test fails for matplotlib 1.5+ because the size of the image
    # generated by matplotlib has changed.
    if LooseVersion(matplotlib.__version__) >= LooseVersion('1.5.0'):
        raise SkipTest("Test fails for matplotlib version > 1.5.0");
    np.random.seed(0)  # image size depends on the seed
    fig, ax = plt.subplots(figsize=(2, 2))
    ax.imshow(np.random.random((10, 10)),
              cmap=plt.cm.jet, interpolation='nearest')
    _assert_output_equal(fake_renderer_output(fig, FakeRenderer),
                         """
                         opening figure
                         opening axes
                         draw image of size 1240 
                         closing axes
                         closing figure
                         """) 
开发者ID:mpld3,项目名称:mplexporter,代码行数:19,代码来源:test_basic.py

示例6: __getstate__

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def __getstate__(self):
        state = self.__dict__.copy()
        # the axobservers cannot currently be pickled.
        # Additionally, the canvas cannot currently be pickled, but this has
        # the benefit of meaning that a figure can be detached from one canvas,
        # and re-attached to another.
        for attr_to_pop in ('_axobservers', 'show',
                            'canvas', '_cachedRenderer'):
            state.pop(attr_to_pop, None)

        # add version information to the state
        state['__mpl_version__'] = _mpl_version

        # check to see if the figure has a manager and whether it is registered
        # with pyplot
        if getattr(self.canvas, 'manager', None) is not None:
            manager = self.canvas.manager
            import matplotlib._pylab_helpers
            if manager in list(six.itervalues(
                    matplotlib._pylab_helpers.Gcf.figs)):
                state['_restore_to_pylab'] = True

        return state 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:25,代码来源:figure.py

示例7: __init__

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def __init__(self, canvas, legend):
        NavigationToolbar2Wx.__init__(self, canvas)
        self._canvas = canvas
        self._legend = legend
        self._autoScale = True

        if matplotlib.__version__ >= '1.2':
            panId = self.wx_ids['Pan']
        else:
            panId = self.FindById(self._NTB2_PAN).GetId()
        self.ToggleTool(panId, True)
        self.pan()

        checkLegend = wx.CheckBox(self, label='Legend')
        checkLegend.SetValue(legend.get_visible())
        self.AddControl(checkLegend)
        self.Bind(wx.EVT_CHECKBOX, self.__on_legend, checkLegend, id)

        if wx.__version__ >= '2.9.1':
            self.AddStretchableSpace()
        else:
            self.AddSeparator()

        self._textCursor = wx.StaticText(self, style=wx.ALL | wx.ALIGN_RIGHT)
        font = self._textCursor.GetFont()
        if wx.__version__ >= '2.9.1':
            font.MakeSmaller()
        font.SetFamily(wx.FONTFAMILY_TELETYPE)
        self._textCursor.SetFont(font)
        w, _h = get_text_size(' ' * 18, font)
        self._textCursor.SetSize((w, -1))

        self.AddControl(self._textCursor)

        self.Realize() 
开发者ID:EarToEarOak,项目名称:RF-Monitor,代码行数:37,代码来源:navigation_toolbar.py

示例8: sysinfo

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def sysinfo():
    import sys
    import time
    import numpy as np
    import scipy as sp
    import matplotlib

    print("Date:       %s" % (time.strftime("%D")))
    version = sys.version_info
    major, minor, micro = version.major, version.minor, version.micro
    print("Python:     %d.%d.%d" % (major, minor, micro))
    print("Numpy:     ", np.__version__)
    print("Scipy:     ", sp.__version__)
    print("Matplotlib:", matplotlib.__version__) 
开发者ID:ASPP,项目名称:ASPP-2018-numpy,代码行数:16,代码来源:tools.py

示例9: _mpl_version

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def _mpl_version(version, op):
    def inner():
        try:
            import matplotlib as mpl
        except ImportError:
            return False
        return (op(LooseVersion(mpl.__version__), LooseVersion(version)) and
                str(mpl.__version__)[0] != '0')

    return inner 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:12,代码来源:_compat.py

示例10: _rendering_kwargs

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def _rendering_kwargs(self):
        return dict(
            allow_inputs=self._allow_inputs,
            column_headers=self._plot_names,
            input_status=self._input_status,
            input_stylesheet=self._input_stylesheet,
            matplotlib_version=matplotlib.__version__,
        ) 
开发者ID:tonysyu,项目名称:matplotlib-style-gallery,代码行数:10,代码来源:app.py

示例11: get_pandas_status

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def get_pandas_status():
    try:
        import pandas as pd
        return _check_version(pd.__version__, pandas_min_version)
    except ImportError:
        traceback.print_exc()
        return default_status 
开发者ID:tgsmith61591,项目名称:skutil,代码行数:9,代码来源:setup.py

示例12: get_sklearn_status

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def get_sklearn_status():
    try:
        import sklearn as sk
        return _check_version(sk.__version__, sklearn_min_version)
    except ImportError:
        traceback.print_exc()
        return default_status 
开发者ID:tgsmith61591,项目名称:skutil,代码行数:9,代码来源:setup.py

示例13: get_numpy_status

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def get_numpy_status():
    try:
        import numpy as np
        return _check_version(np.__version__, numpy_min_version)
    except ImportError:
        traceback.print_exc()
        return default_status 
开发者ID:tgsmith61591,项目名称:skutil,代码行数:9,代码来源:setup.py

示例14: get_scipy_status

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def get_scipy_status():
    try:
        import scipy as sc
        return _check_version(sc.__version__, scipy_min_version)
    except ImportError:
        traceback.print_exc()
        return default_status 
开发者ID:tgsmith61591,项目名称:skutil,代码行数:9,代码来源:setup.py

示例15: get_h2o_status

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import __version__ [as 别名]
def get_h2o_status():
    try:
        import h2o
        return _check_version(h2o.__version__, h2o_min_version)
    except ImportError:
        traceback.print_exc()
        return default_status 
开发者ID:tgsmith61591,项目名称:skutil,代码行数:9,代码来源:setup.py


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