本文整理匯總了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