classmatplotlib.dates.relativedelta(dt1=None, dt2=None, years=0, months=0, days=0, leapdays=0, weeks=0, hours=0, minutes=0, seconds=0, microseconds=0, year=None, month=None, day=None, weekday=None, yearday=None, nlyearday=None, hour=None, minute=None, second=None, microsecond=None)

Bases: object The relativedelta type is designed to be applied to an existing datetime and can replace specific components of that datetime, or represents an interval of time. It is based on the specification of the excellent work done by M.-A. Lemburg in his mx.DateTime extension. However, notice that this type does NOT implement the same algorithm as his work. Do NOT expect it to behave like mx.DateTime's counterpart. There are two different ways to build a relativedelta instance. The first one is passing it two date/datetime classes: relativedelta(datetime1, datetime2)
 The second one is passing it any number of the following keyword arguments: relativedelta(arg1=x,arg2=y,arg3=z...)

year, month, day, hour, minute, second, microsecond:
    Absolute information (argument is singular); adding or subtracting a
    relativedelta with absolute information does not perform an arithmetic
    operation, but rather REPLACES the corresponding value in the
    original datetime with the value(s) in relativedelta.

years, months, weeks, days, hours, minutes, seconds, microseconds:
    Relative information, may be negative (argument is plural); adding
    or subtracting a relativedelta with relative information performs
    the corresponding arithmetic operation on the original datetime value
    with the information in the relativedelta.

weekday:
    One of the weekday instances (MO, TU, etc) available in the
    relativedelta module. These instances may receive a parameter N,
    specifying the Nth weekday, which could be positive or negative
    (like MO(+1) or MO(-2)). Not specifying it is the same as specifying
    +1. You can also use an integer, where 0=MO. This argument is always
    relative e.g. if the calculated date is already Monday, using MO(1)
    or MO(-1) won't change the day. To effectively make it absolute, use
    it in combination with the day argument (e.g. day=1, MO(1) for first
    Monday of the month).

leapdays:
    Will add given days to the date found, if year is a leap
    year, and the date found is post 28 of february.

yearday, nlyearday:
    Set the yearday or the non-leap year day (jump leap days).
    These are converted to day/month/leapdays information.
 There are relative and absolute forms of the keyword arguments. The plural is relative, and the singular is absolute. For each argument in the order below, the absolute form is applied first (by setting each attribute to that value) and then the relative form (by adding the value to the attribute). The order of attributes considered when this relativedelta is added to a datetime is:  Year Month Day Hours Minutes Seconds Microseconds  Finally, weekday is applied, using the rule described above. For example >>> from datetime import datetime
>>> from dateutil.relativedelta import relativedelta, MO
>>> dt = datetime(2018, 4, 9, 13, 37, 0)
>>> delta = relativedelta(hours=25, day=1, weekday=MO(1))
>>> dt + delta
datetime.datetime(2018, 4, 2, 14, 37)
 First, the day is set to 1 (the first of the month), then 25 hours are added, to get to the 2nd day and 14th hour, finally the weekday is applied, but since the 2nd is already a Monday there is no effect.   normalized()

Return a version of this object represented entirely using integer values for the relative attributes. >>> relativedelta(days=1.5, hours=2).normalized()
relativedelta(days=+1, hours=+14)
  Returns
Returns a dateutil.relativedelta.relativedelta object.
   propertyweeks


normalized()

Return a version of this object represented entirely using integer values for the relative attributes. >>> relativedelta(days=1.5, hours=2).normalized()
relativedelta(days=+1, hours=+14)
  Returns
Returns a dateutil.relativedelta.relativedelta object.


classmatplotlib.dates.rrule(freq, dtstart=None, interval=1, wkst=None, count=None, until=None, bysetpos=None, bymonth=None, bymonthday=None, byyearday=None, byeaster=None, byweekno=None, byweekday=None, byhour=None, byminute=None, bysecond=None, cache=False)

Bases: dateutil.rrule.rrulebase That's the base of the rrule operation. It accepts all the keywords defined in the RFC as its constructor parameters (except byday, which was renamed to byweekday) and more. The constructor prototype is: rrule(freq)
 Where freq must be one of YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, or SECONDLY.  Note Per RFC section 3.3.10, recurrence instances falling on invalid dates and times are ignored rather than coerced: Recurrence rules may generate recurrence instances with an invalid date (e.g., February 30) or nonexistent local time (e.g., 1:30 AM on a day where the local time is moved forward by an hour at 1:00 AM). Such recurrence instances MUST be ignored and MUST NOT be counted as part of the recurrence set. This can lead to possibly surprising behavior when, for example, the start date occurs at the end of the month: >>> from dateutil.rrule import rrule, MONTHLY
>>> from datetime import datetime
>>> start_date = datetime(2014, 12, 31)
>>> list(rrule(freq=MONTHLY, count=4, dtstart=start_date))
...
[datetime.datetime(2014, 12, 31, 0, 0),
 datetime.datetime(2015, 1, 31, 0, 0),
 datetime.datetime(2015, 3, 31, 0, 0),
 datetime.datetime(2015, 5, 31, 0, 0)]
  Additionally, it supports the following keyword arguments:  Parameters

dtstart -- The recurrence start. Besides being the base for the recurrence, missing parameters in the final recurrence instances will also be extracted from this date. If not given, datetime.now() will be used instead.
interval -- The interval between each freq iteration. For example, when using YEARLY, an interval of 2 means once every two years, but with HOURLY, it means once every two hours. The default interval is 1.
wkst -- The week start day. Must be one of the MO, TU, WE constants, or an integer, specifying the first day of the week. This will affect recurrences based on weekly periods. The default week start is got from calendar.firstweekday(), and may be modified by calendar.setfirstweekday().
count --
If given, this determines how many occurrences will be generated.  Note As of version 2.5.0, the use of the keyword until in conjunction with count is deprecated, to make sure dateutil is fully compliant with RFC-5545 Sec. 3.3.10. Therefore, until and count must not occur in the same call to rrule.
until --
If given, this must be a datetime instance specifying the upper-bound limit of the recurrence. The last recurrence in the rule is the greatest datetime that is less than or equal to the value specified in the until parameter.  Note As of version 2.5.0, the use of the keyword until in conjunction with count is deprecated, to make sure dateutil is fully compliant with RFC-5545 Sec. 3.3.10. Therefore, until and count must not occur in the same call to rrule.
bysetpos -- If given, it must be either an integer, or a sequence of integers, positive or negative. Each given integer will specify an occurrence number, corresponding to the nth occurrence of the rule inside the frequency period. For example, a bysetpos of -1 if combined with a MONTHLY frequency, and a byweekday of (MO, TU, WE, TH, FR), will result in the last work day of every month.
bymonth -- If given, it must be either an integer, or a sequence of integers, meaning the months to apply the recurrence to.
bymonthday -- If given, it must be either an integer, or a sequence of integers, meaning the month days to apply the recurrence to.
byyearday -- If given, it must be either an integer, or a sequence of integers, meaning the year days to apply the recurrence to.
byeaster -- If given, it must be either an integer, or a sequence of integers, positive or negative. Each integer will define an offset from the Easter Sunday. Passing the offset 0 to byeaster will yield the Easter Sunday itself. This is an extension to the RFC specification.
byweekno -- If given, it must be either an integer, or a sequence of integers, meaning the week numbers to apply the recurrence to. Week numbers have the meaning described in ISO8601, that is, the first week of the year is that containing at least four days of the new year.
byweekday -- If given, it must be either an integer (0 == MO), a sequence of integers, one of the weekday constants (MO, TU, etc), or a sequence of these constants. When given, these variables will define the weekdays where the recurrence will be applied. It's also possible to use an argument n for the weekday instances, which will mean the nth occurrence of this weekday in the period. For example, with MONTHLY, or with YEARLY and BYMONTH, using FR(+1) in byweekday will specify the first friday of the month where the recurrence happens. Notice that in the RFC documentation, this is specified as BYDAY, but was renamed to avoid the ambiguity of that keyword.
byhour -- If given, it must be either an integer, or a sequence of integers, meaning the hours to apply the recurrence to.
byminute -- If given, it must be either an integer, or a sequence of integers, meaning the minutes to apply the recurrence to.
bysecond -- If given, it must be either an integer, or a sequence of integers, meaning the seconds to apply the recurrence to.
cache -- If given, it must be a boolean value specifying to enable or disable caching of results. If you will use the same rrule instance multiple times, enabling caching will improve the performance considerably.      replace(**kwargs)

Return new rrule with same attributes except for those attributes given new values by whichever keyword arguments are specified.


replace(**kwargs)

Return new rrule with same attributes except for those attributes given new values by whichever keyword arguments are specified.


classmatplotlib.dates.RRuleLocator(o, tz=None)[source]

Bases: matplotlib.dates.DateLocator  Parameters

tzdatetime.tzinfo

     staticget_unit_generic(freq)[source]

   tick_values(vmin, vmax)[source]

Return the values of the located ticks given vmin and vmax.  Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc))
<type 'Locator'>
>>> print(loc())
[1, 2, 3, 4]


tick_values(vmin, vmax)[source]

Return the values of the located ticks given vmin and vmax.  Note To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance: >>> print(type(loc))
<type 'Locator'>
>>> print(loc())
[1, 2, 3, 4]


classmatplotlib.dates.SecondLocator(bysecond=None, interval=1, tz=None)[source]

Bases: matplotlib.dates.RRuleLocator Make ticks on occurrences of each second. Mark every second in bysecond; bysecond can be an int or sequence. Default is to tick every second: bysecond = range(60) interval is the interval between each iteration. For example, if interval=2, mark every second occurrence.


matplotlib.dates.set_epoch(epoch)[source]

Set the epoch (origin for dates) for datetime calculations. The default epoch is rcParams["dates.epoch"] (by default 1970-01-01T00:00). If microsecond accuracy is desired, the date being plotted needs to be within approximately 70 years of the epoch. Matplotlib internally represents dates as days since the epoch, so floating point dynamic range needs to be within a factor of 2^52. set_epoch must be called before any dates are converted (i.e. near the import section) or a RuntimeError will be raised. See also Date Precision and Epochs.  Parameters

epochstr

valid UTC date parsable by numpy.datetime64 (do not include timezone).


classmatplotlib.dates.WeekdayLocator(byweekday=1, interval=1, tz=None)[source]

Bases: matplotlib.dates.RRuleLocator Make ticks on occurrences of each weekday. Mark every weekday in byweekday; byweekday can be a number or sequence. Elements of byweekday must be one of MO, TU, WE, TH, FR, SA, SU, the constants from dateutil.rrule, which have been imported into the matplotlib.dates namespace. interval specifies the number of weeks to skip. For example, interval=2 plots every second week.


classmatplotlib.dates.YearLocator(base=1, month=1, day=1, tz=None)[source]

Bases: matplotlib.dates.RRuleLocator Make ticks on a given day of each year that is a multiple of base. Examples: # Tick every year on Jan 1st
locator = YearLocator()

# Tick every 5 years on July 4th
locator = YearLocator(5, month=7, day=4)
 Mark years that are multiple of base on a given month and day (default jan 1).


matplotlib.docstring   classmatplotlib.docstring.Substitution(*args, **kwargs)[source]

Bases: object A decorator that performs %-substitution on an object's docstring. This decorator should be robust even if obj.__doc__ is None (for example, if -OO was passed to the interpreter). Usage: construct a docstring.Substitution with a sequence or dictionary suitable for performing substitution; then decorate a suitable function with the constructed object, e.g.: sub_author_name = Substitution(author='Jason')

@sub_author_name
def some_function(x):
    "%(author)s wrote this function"

# note that some_function.__doc__ is now "Jason wrote this function"
 One can also use positional arguments: sub_first_last_names = Substitution('Edgar Allen', 'Poe')

@sub_first_last_names
def some_function(x):
    "%s %s wrote the Raven"
   update(*args, **kwargs)[source]

Update self.params (which must be a dict) with the supplied args.

   matplotlib.docstring.copy(source)[source]

Copy a docstring from another source function (if present).


matplotlib.docstring.copy(source)[source]

Copy a docstring from another source function (if present).


classmatplotlib.docstring.Substitution(*args, **kwargs)[source]

Bases: object A decorator that performs %-substitution on an object's docstring. This decorator should be robust even if obj.__doc__ is None (for example, if -OO was passed to the interpreter). Usage: construct a docstring.Substitution with a sequence or dictionary suitable for performing substitution; then decorate a suitable function with the constructed object, e.g.: sub_author_name = Substitution(author='Jason')

@sub_author_name
def some_function(x):
    "%(author)s wrote this function"

# note that some_function.__doc__ is now "Jason wrote this function"
 One can also use positional arguments: sub_first_last_names = Substitution('Edgar Allen', 'Poe')

@sub_first_last_names
def some_function(x):
    "%s %s wrote the Raven"
   update(*args, **kwargs)[source]

Update self.params (which must be a dict) with the supplied args.


update(*args, **kwargs)[source]

Update self.params (which must be a dict) with the supplied args.


matplotlib.dviread A module for reading dvi files output by TeX. Several limitations make this not (currently) useful as a general-purpose dvi preprocessor, but it is currently used by the pdf backend for processing usetex text. Interface: with Dvi(filename, 72) as dvi:
    # iterate over pages:
    for page in dvi:
        w, h, d = page.width, page.height, page.descent
        for x, y, font, glyph, width in page.text:
            fontname = font.texname
            pointsize = font.size
            ...
        for x, y, height, width in page.boxes:
            ...
   classmatplotlib.dviread.Dvi(filename, dpi)[source]

Bases: object A reader for a dvi ("device-independent") file, as produced by TeX. The current implementation can only iterate through pages in order, and does not even attempt to verify the postamble. This class can be used as a context manager to close the underlying file upon exit. Pages can be read via iteration. Here is an overly simple way to extract text without trying to detect whitespace: >>> with matplotlib.dviread.Dvi('input.dvi', 72) as dvi:
...     for page in dvi:
...         print(''.join(chr(t.glyph) for t in page.text))
 Read the data from the file named filename and convert TeX's internal units to units of dpi per inch. dpi only sets the units and does not limit the resolution. Use None to return TeX's internal units.   propertybaseline[source]

   close()[source]

Close the underlying file if it is open.

   classmatplotlib.dviread.DviFont(scale, tfm, texname, vf)[source]

Bases: object Encapsulation of a font that a DVI file can refer to. This class holds a font's texname and size, supports comparison, and knows the widths of glyphs in the same units as the AFM file. There are also internal attributes (for use by dviread.py) that are not used for comparison. The size is in Adobe points (converted from TeX points).  Parameters

scalefloat

Factor by which the font is scaled from its natural size.
tfmTfm

TeX font metrics for this font
texnamebytes

Name of the font as used internally by TeX and friends, as an ASCII bytestring. This is usually very different from any external font names; PsfontsMap can be used to find the external name of the font.
vfVf

A TeX "virtual font" file, or None if this font is not virtual.    Attributes

texnamebytes

sizefloat

Size of the font in Adobe points, converted from the slightly smaller TeX points.
widthslist

Widths of glyphs in glyph-space units, typically 1/1000ths of the point size.       size

   texname

   widths

   classmatplotlib.dviread.PsFont(texname, psname, effects, encoding, filename)[source]

Bases: tuple Create new instance of PsFont(texname, psname, effects, encoding, filename)   effects

Alias for field number 2
   encoding

Alias for field number 3
   filename

Alias for field number 4
   psname

Alias for field number 1
   texname

Alias for field number 0

   classmatplotlib.dviread.PsfontsMap(filename)[source]

Bases: object A psfonts.map formatted file, mapping TeX fonts to PS fonts.  Parameters

filenamestr or path-like

   Notes For historical reasons, TeX knows many Type-1 fonts by different names than the outside world. (For one thing, the names have to fit in eight characters.) Also, TeX's native fonts are not Type-1 but Metafont, which is nontrivial to convert to PostScript except as a bitmap. While high-quality conversions to Type-1 format exist and are shipped with modern TeX distributions, we need to know which Type-1 fonts are the counterparts of which native fonts. For these reasons a mapping is needed from internal font names to font file names. A texmf tree typically includes mapping files called e.g. psfonts.map, pdftex.map, or dvipdfm.map. The file psfonts.map is used by dvips, pdftex.map by pdfTeX, and dvipdfm.map by dvipdfm. psfonts.map might avoid embedding the 35 PostScript fonts (i.e., have no filename for them, as in the Times-Bold example above), while the pdf-related files perhaps only avoid the "Base 14" pdf fonts. But the user may have configured these files differently. Examples >>> map = PsfontsMap(find_tex_file('pdftex.map'))
>>> entry = map[b'ptmbo8r']
>>> entry.texname
b'ptmbo8r'
>>> entry.psname
b'Times-Bold'
>>> entry.encoding
'/usr/local/texlive/2008/texmf-dist/fonts/enc/dvips/base/8r.enc'
>>> entry.effects
{'slant': 0.16700000000000001}
>>> entry.filename

   classmatplotlib.dviread.Tfm(filename)[source]

Bases: object A TeX Font Metric file. This implementation covers only the bare minimum needed by the Dvi class.  Parameters

filenamestr or path-like

  Attributes

checksumint

Used for verifying against the dvi file.
design_sizeint

Design size of the font (unknown units)
width, height, depthdict

Dimensions of each character, need to be scaled by the factor specified in the dvi file. These are dicts because indexing may not start from 0.       checksum

   depth

   design_size

   height

   width

   classmatplotlib.dviread.Vf(filename)[source]

Bases: matplotlib.dviread.Dvi A virtual font (*.vf file) containing subroutines for dvi files.  Parameters

filenamestr or path-like

   Notes The virtual font format is a derivative of dvi: http://mirrors.ctan.org/info/knuth/virtual-fonts This class reuses some of the machinery of Dvi but replaces the _read loop and dispatch mechanism. Examples vf = Vf(filename)
glyph = vf[code]
glyph.text, glyph.boxes, glyph.width
 Read the data from the file named filename and convert TeX's internal units to units of dpi per inch. dpi only sets the units and does not limit the resolution. Use None to return TeX's internal units.
   matplotlib.dviread.find_tex_file(filename, format=<deprecated parameter>)[source]

Find a file in the texmf tree. Calls kpsewhich which is an interface to the kpathsea library [1]. Most existing TeX distributions on Unix-like systems use kpathsea. It is also available as part of MikTeX, a popular distribution on Windows. If the file is not found, an empty string is returned.  Parameters

filenamestr or path-like

formatstr or bytes

Used as the value of the --format option to kpsewhich. Could be e.g. 'tfm' or 'vf' to limit the search to that type of files. Deprecated.     References  1
Kpathsea documentation The library that kpsewhich is part of.


classmatplotlib.dviread.Dvi(filename, dpi)[source]

Bases: object A reader for a dvi ("device-independent") file, as produced by TeX. The current implementation can only iterate through pages in order, and does not even attempt to verify the postamble. This class can be used as a context manager to close the underlying file upon exit. Pages can be read via iteration. Here is an overly simple way to extract text without trying to detect whitespace: >>> with matplotlib.dviread.Dvi('input.dvi', 72) as dvi:
...     for page in dvi:
...         print(''.join(chr(t.glyph) for t in page.text))
 Read the data from the file named filename and convert TeX's internal units to units of dpi per inch. dpi only sets the units and does not limit the resolution. Use None to return TeX's internal units.   propertybaseline[source]

   close()[source]

Close the underlying file if it is open.


close()[source]

Close the underlying file if it is open.


classmatplotlib.dviread.DviFont(scale, tfm, texname, vf)[source]

Bases: object Encapsulation of a font that a DVI file can refer to. This class holds a font's texname and size, supports comparison, and knows the widths of glyphs in the same units as the AFM file. There are also internal attributes (for use by dviread.py) that are not used for comparison. The size is in Adobe points (converted from TeX points).  Parameters

scalefloat

Factor by which the font is scaled from its natural size.
tfmTfm

TeX font metrics for this font
texnamebytes

Name of the font as used internally by TeX and friends, as an ASCII bytestring. This is usually very different from any external font names; PsfontsMap can be used to find the external name of the font.
vfVf

A TeX "virtual font" file, or None if this font is not virtual.    Attributes

texnamebytes

sizefloat

Size of the font in Adobe points, converted from the slightly smaller TeX points.
widthslist

Widths of glyphs in glyph-space units, typically 1/1000ths of the point size.       size

   texname

   widths


matplotlib.dviread.find_tex_file(filename, format=<deprecated parameter>)[source]

Find a file in the texmf tree. Calls kpsewhich which is an interface to the kpathsea library [1]. Most existing TeX distributions on Unix-like systems use kpathsea. It is also available as part of MikTeX, a popular distribution on Windows. If the file is not found, an empty string is returned.  Parameters

filenamestr or path-like

formatstr or bytes

Used as the value of the --format option to kpsewhich. Could be e.g. 'tfm' or 'vf' to limit the search to that type of files. Deprecated.     References  1
Kpathsea documentation The library that kpsewhich is part of.


classmatplotlib.dviread.PsFont(texname, psname, effects, encoding, filename)[source]

Bases: tuple Create new instance of PsFont(texname, psname, effects, encoding, filename)   effects

Alias for field number 2
   encoding

Alias for field number 3
   filename

Alias for field number 4
   psname

Alias for field number 1
   texname

Alias for field number 0


classmatplotlib.dviread.PsfontsMap(filename)[source]

Bases: object A psfonts.map formatted file, mapping TeX fonts to PS fonts.  Parameters

filenamestr or path-like

   Notes For historical reasons, TeX knows many Type-1 fonts by different names than the outside world. (For one thing, the names have to fit in eight characters.) Also, TeX's native fonts are not Type-1 but Metafont, which is nontrivial to convert to PostScript except as a bitmap. While high-quality conversions to Type-1 format exist and are shipped with modern TeX distributions, we need to know which Type-1 fonts are the counterparts of which native fonts. For these reasons a mapping is needed from internal font names to font file names. A texmf tree typically includes mapping files called e.g. psfonts.map, pdftex.map, or dvipdfm.map. The file psfonts.map is used by dvips, pdftex.map by pdfTeX, and dvipdfm.map by dvipdfm. psfonts.map might avoid embedding the 35 PostScript fonts (i.e., have no filename for them, as in the Times-Bold example above), while the pdf-related files perhaps only avoid the "Base 14" pdf fonts. But the user may have configured these files differently. Examples >>> map = PsfontsMap(find_tex_file('pdftex.map'))
>>> entry = map[b'ptmbo8r']
>>> entry.texname
b'ptmbo8r'
>>> entry.psname
b'Times-Bold'
>>> entry.encoding
'/usr/local/texlive/2008/texmf-dist/fonts/enc/dvips/base/8r.enc'
>>> entry.effects
{'slant': 0.16700000000000001}
>>> entry.filename


classmatplotlib.dviread.Tfm(filename)[source]

Bases: object A TeX Font Metric file. This implementation covers only the bare minimum needed by the Dvi class.  Parameters

filenamestr or path-like

  Attributes

checksumint

Used for verifying against the dvi file.
design_sizeint

Design size of the font (unknown units)
width, height, depthdict

Dimensions of each character, need to be scaled by the factor specified in the dvi file. These are dicts because indexing may not start from 0.       checksum

   depth

   design_size

   height

   width


classmatplotlib.dviread.Vf(filename)[source]

Bases: matplotlib.dviread.Dvi A virtual font (*.vf file) containing subroutines for dvi files.  Parameters

filenamestr or path-like

   Notes The virtual font format is a derivative of dvi: http://mirrors.ctan.org/info/knuth/virtual-fonts This class reuses some of the machinery of Dvi but replaces the _read loop and dispatch mechanism. Examples vf = Vf(filename)
glyph = vf[code]
glyph.text, glyph.boxes, glyph.width
 Read the data from the file named filename and convert TeX's internal units to units of dpi per inch. dpi only sets the units and does not limit the resolution. Use None to return TeX's internal units.