當前位置: 首頁>>代碼示例>>Python>>正文


Python matplotlib.units方法代碼示例

本文整理匯總了Python中matplotlib.units方法的典型用法代碼示例。如果您正苦於以下問題:Python matplotlib.units方法的具體用法?Python matplotlib.units怎麽用?Python matplotlib.units使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib的用法示例。


在下文中一共展示了matplotlib.units方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: axisinfo

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import units [as 別名]
def axisinfo(unit, axis):
        """
        Return the :class:`~matplotlib.units.AxisInfo` for *unit*.

        *unit* is a tzinfo instance or None.
        The *axis* argument is required but not used.
        """
        tz = unit

        majloc = AutoDateLocator(tz=tz)
        majfmt = AutoDateFormatter(majloc, tz=tz)
        datemin = datetime.date(2000, 1, 1)
        datemax = datetime.date(2010, 1, 1)

        return units.AxisInfo(majloc=majloc, majfmt=majfmt, label='',
                              default_limits=(datemin, datemax)) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:18,代碼來源:dates.py

示例2: _get_interval

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import units [as 別名]
def _get_interval(self):
        """
        Return the number of units for each tick.
        """
        return 1 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:7,代碼來源:dates.py

示例3: convert

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import units [as 別名]
def convert(value, unit, axis):
        """
        If *value* is not already a number or sequence of numbers,
        convert it with :func:`date2num`.

        The *unit* and *axis* arguments are not used.
        """
        if units.ConversionInterface.is_numlike(value):
            return value
        return date2num(value) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:12,代碼來源:dates.py

示例4: setup_class

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import units [as 別名]
def setup_class(cls):
        cls.original_units_registry = matplotlib.units.registry.copy() 
開發者ID:Solid-Mechanics,項目名稱:matplotlib-4-abaqus,代碼行數:4,代碼來源:decorators.py

示例5: datalim_to_dt

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import units [as 別名]
def datalim_to_dt(self):
        """
        Convert axis data interval to datetime objects.
        """
        dmin, dmax = self.axis.get_data_interval()
        if dmin > dmax:
            dmin, dmax = dmax, dmin
        if dmin < 1:
            raise ValueError('datalim minimum {} is less than 1 and '
                             'is an invalid Matplotlib date value. This often '
                             'happens if you pass a non-datetime '
                             'value to an axis that has datetime units'
                             .format(dmin))
        return num2date(dmin, self.tz), num2date(dmax, self.tz) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:16,代碼來源:dates.py

示例6: viewlim_to_dt

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import units [as 別名]
def viewlim_to_dt(self):
        """
        Converts the view interval to datetime objects.
        """
        vmin, vmax = self.axis.get_view_interval()
        if vmin > vmax:
            vmin, vmax = vmax, vmin
        if vmin < 1:
            raise ValueError('view limit minimum {} is less than 1 and '
                             'is an invalid Matplotlib date value. This '
                             'often happens if you pass a non-datetime '
                             'value to an axis that has datetime units'
                             .format(vmin))
        return num2date(vmin, self.tz), num2date(vmax, self.tz) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:16,代碼來源:dates.py

示例7: units

# 需要導入模塊: import matplotlib [as 別名]
# 或者: from matplotlib import units [as 別名]
def units(self):
        if self._units is None:
            try:
                from astropy import units

                self.log
            except ImportError:
                units = NotAModule(self._name)
            self._units = units
        return self._units 
開發者ID:yt-project,項目名稱:unyt,代碼行數:12,代碼來源:_on_demand_imports.py


注:本文中的matplotlib.units方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。