當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。