Python matplotlib.units() Examples
The following are 30 code examples for showing how to use matplotlib.units(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
You may check out the related API usage on the sidebar.
You may also want to check out all available functions/classes of the module
matplotlib
, or try the search function
.
Example 1
Project: Computable Author: ktraunmueller File: dates.py License: MIT License | 6 votes |
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))
Example 2
Project: matplotlib-4-abaqus Author: Solid-Mechanics File: dates.py License: MIT License | 6 votes |
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))
Example 3
Project: neural-network-animation Author: miloharper File: dates.py License: MIT License | 6 votes |
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))
Example 4
Project: GraphicDesignPatternByPython Author: Relph1119 File: dates.py License: MIT License | 6 votes |
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))
Example 5
Project: python3_ios Author: holzschu File: dates.py License: BSD 3-Clause "New" or "Revised" License | 6 votes |
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))
Example 6
Project: coffeegrindsize Author: jgagneastro File: dates.py License: MIT License | 6 votes |
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))
Example 7
Project: CogAlg Author: boris-kz File: dates.py License: MIT License | 6 votes |
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))
Example 8
Project: twitter-stock-recommendation Author: alvarobartt File: dates.py License: MIT License | 6 votes |
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))
Example 9
Project: Computable Author: ktraunmueller File: dates.py License: MIT License | 5 votes |
def _get_interval(self): """ Return the number of units for each tick. """ return 1
Example 10
Project: Computable Author: ktraunmueller File: dates.py License: MIT License | 5 votes |
def _get_interval(self): """ Return the number of units for each tick. """ return self._interval
Example 11
Project: Computable Author: ktraunmueller File: dates.py License: MIT License | 5 votes |
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)
Example 12
Project: matplotlib-4-abaqus Author: Solid-Mechanics File: dates.py License: MIT License | 5 votes |
def _get_interval(self): """ Return the number of units for each tick. """ return 1
Example 13
Project: matplotlib-4-abaqus Author: Solid-Mechanics File: dates.py License: MIT License | 5 votes |
def _get_interval(self): """ Return the number of units for each tick. """ return self._interval
Example 14
Project: matplotlib-4-abaqus Author: Solid-Mechanics File: dates.py License: MIT License | 5 votes |
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)
Example 15
Project: matplotlib-4-abaqus Author: Solid-Mechanics File: decorators.py License: MIT License | 5 votes |
def setup_class(cls): cls.original_units_registry = matplotlib.units.registry.copy()
Example 16
Project: neural-network-animation Author: miloharper File: dates.py License: MIT License | 5 votes |
def _get_interval(self): """ Return the number of units for each tick. """ return 1
Example 17
Project: neural-network-animation Author: miloharper File: dates.py License: MIT License | 5 votes |
def _get_interval(self): """ Return the number of units for each tick. """ return self._interval
Example 18
Project: neural-network-animation Author: miloharper File: dates.py License: MIT License | 5 votes |
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)
Example 19
Project: GraphicDesignPatternByPython Author: Relph1119 File: dates.py License: MIT License | 5 votes |
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)
Example 20
Project: GraphicDesignPatternByPython Author: Relph1119 File: dates.py License: MIT License | 5 votes |
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)
Example 21
Project: GraphicDesignPatternByPython Author: Relph1119 File: dates.py License: MIT License | 5 votes |
def _get_interval(self): """ Return the number of units for each tick. """ return 1
Example 22
Project: GraphicDesignPatternByPython Author: Relph1119 File: dates.py License: MIT License | 5 votes |
def _get_interval(self): """ Return the number of units for each tick. """ return self._interval
Example 23
Project: python3_ios Author: holzschu File: dates.py License: BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example 24
Project: python3_ios Author: holzschu File: dates.py License: BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example 25
Project: python3_ios Author: holzschu File: dates.py License: BSD 3-Clause "New" or "Revised" License | 5 votes |
def _get_interval(self): """ Return the number of units for each tick. """ return 1
Example 26
Project: python3_ios Author: holzschu File: dates.py License: BSD 3-Clause "New" or "Revised" License | 5 votes |
def _get_interval(self): """ Return the number of units for each tick. """ return self._interval
Example 27
Project: unyt Author: yt-project File: _on_demand_imports.py License: BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example 28
Project: unyt Author: yt-project File: _on_demand_imports.py License: BSD 3-Clause "New" or "Revised" License | 5 votes |
def units(self): if self._units is None: try: from matplotlib import units except ImportError: units = NotAModule(self._name) self._units = units return self._units
Example 29
Project: coffeegrindsize Author: jgagneastro File: dates.py License: MIT License | 5 votes |
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)
Example 30
Project: coffeegrindsize Author: jgagneastro File: dates.py License: MIT License | 5 votes |
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)