本文整理汇总了Python中matplotlib.units.AxisInfo方法的典型用法代码示例。如果您正苦于以下问题:Python units.AxisInfo方法的具体用法?Python units.AxisInfo怎么用?Python units.AxisInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.units
的用法示例。
在下文中一共展示了units.AxisInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: axisinfo
# 需要导入模块: from matplotlib import units [as 别名]
# 或者: from matplotlib.units import AxisInfo [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 = PandasAutoDateLocator(tz=tz)
majfmt = PandasAutoDateFormatter(majloc, tz=tz)
datemin = pydt.date(2000, 1, 1)
datemax = pydt.date(2010, 1, 1)
return units.AxisInfo(majloc=majloc, majfmt=majfmt, label='',
default_limits=(datemin, datemax))
示例2: axisinfo
# 需要导入模块: from matplotlib import units [as 别名]
# 或者: from matplotlib.units import AxisInfo [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))
示例3: axisinfo
# 需要导入模块: from matplotlib import units [as 别名]
# 或者: from matplotlib.units import AxisInfo [as 别名]
def axisinfo(unit, axis):
"""Sets the default axis ticks and labels
Parameters
----------
unit : `.UnitData`
object string unit information for value
axis : `~matplotlib.Axis.axis`
axis for which information is being set
Returns
-------
axisinfo : `~matplotlib.units.AxisInfo`
Information to support default tick labeling
.. note: axis is not used
"""
# locator and formatter take mapping dict because
# args need to be pass by reference for updates
majloc = StrCategoryLocator(unit._mapping)
majfmt = StrCategoryFormatter(unit._mapping)
return units.AxisInfo(majloc=majloc, majfmt=majfmt)
示例4: axisinfo
# 需要导入模块: from matplotlib import units [as 别名]
# 或者: from matplotlib.units import AxisInfo [as 别名]
def axisinfo( unit, axis ):
""": Returns information on how to handle an axis that has Epoch data.
= INPUT VARIABLES
- unit The units to use for a axis with Epoch data.
= RETURN VALUE
- Returns a matplotlib AxisInfo data structure that contains
minor/major formatters, major/minor locators, and default
label information.
"""
majloc = date_ticker.AutoDateLocator()
majfmt = date_ticker.AutoDateFormatter( majloc )
return units.AxisInfo( majloc = majloc,
majfmt = majfmt,
label = unit )
#------------------------------------------------------------------------
示例5: axisinfo
# 需要导入模块: from matplotlib import units [as 别名]
# 或者: from matplotlib.units import AxisInfo [as 别名]
def axisinfo(unit, axis):
"""
Returns the :class:`~matplotlib.units.AxisInfo` for *unit*.
*unit* is a tzinfo instance or None.
The *axis* argument is required but not used.
"""
calendar, date_unit, date_type = unit
majloc = NetCDFTimeDateLocator(4, calendar=calendar,
date_unit=date_unit)
majfmt = NetCDFTimeDateFormatter(majloc, calendar=calendar,
time_units=date_unit)
if date_type is CalendarDateTime:
datemin = CalendarDateTime(cftime.datetime(2000, 1, 1),
calendar=calendar)
datemax = CalendarDateTime(cftime.datetime(2010, 1, 1),
calendar=calendar)
else:
datemin = date_type(2000, 1, 1)
datemax = date_type(2010, 1, 1)
return munits.AxisInfo(majloc=majloc, majfmt=majfmt, label='',
default_limits=(datemin, datemax))
示例6: axisinfo
# 需要导入模块: from matplotlib import units [as 别名]
# 或者: from matplotlib.units import AxisInfo [as 别名]
def axisinfo(unit, axis):
"""Sets the default axis ticks and labels
Parameters
---------
unit : :class:`.UnitData`
object string unit information for value
axis : :class:`~matplotlib.Axis.axis`
axis for which information is being set
Returns
-------
:class:~matplotlib.units.AxisInfo~
Information to support default tick labeling
.. note: axis is not used
"""
# locator and formatter take mapping dict because
# args need to be pass by reference for updates
majloc = StrCategoryLocator(unit._mapping)
majfmt = StrCategoryFormatter(unit._mapping)
return units.AxisInfo(majloc=majloc, majfmt=majfmt)
示例7: axisinfo
# 需要导入模块: from matplotlib import units [as 别名]
# 或者: from matplotlib.units import AxisInfo [as 别名]
def axisinfo(unit, axis):
""": Returns information on how to handle an axis that has Epoch data.
= INPUT VARIABLES
- unit The units to use for a axis with Epoch data.
= RETURN VALUE
- Returns a matplotlib AxisInfo data structure that contains
minor/major formatters, major/minor locators, and default
label information.
"""
majloc = date_ticker.AutoDateLocator()
majfmt = date_ticker.AutoDateFormatter(majloc)
return units.AxisInfo(majloc=majloc, majfmt=majfmt, label=unit)
# -----------------------------------------------------------------------
示例8: axisinfo
# 需要导入模块: from matplotlib import units [as 别名]
# 或者: from matplotlib.units import AxisInfo [as 别名]
def axisinfo(unit, axis):
'return AxisInfo instance for x and unit'
if unit == radians:
return units.AxisInfo(
majloc=ticker.MultipleLocator(base=np.pi/2),
majfmt=ticker.FuncFormatter(rad_fn),
label=unit.fullname,
)
elif unit == degrees:
return units.AxisInfo(
majloc=ticker.AutoLocator(),
majfmt=ticker.FormatStrFormatter(r'$%i^\circ$'),
label=unit.fullname,
)
elif unit is not None:
if hasattr(unit, 'fullname'):
return units.AxisInfo(label=unit.fullname)
elif hasattr(unit, 'unit'):
return units.AxisInfo(label=unit.unit.fullname)
return None